Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Create a JPG/Imagemagick

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Create a JPG/Imagemagick

    We store images of certain types of ID cards in our system. Normally we scan the cards, which takes time to complete and can be problematic at very busy times. OK, says the client, I accept that we have to scan other companies' ID cards, but why do we have to scan our own, why can't we just create the JPG ourselves?

    We create our ID cards by printing an A5 report to an ID Card printer and the card is mailed to the customer. We usually print 50 or more cards n a session and we'd like to avoid having to scan the card before mailing. Going through the card scan/import multi-step process in the application is time consuming. We can't print to JPG like we can to a PDF, so what to do?

    The only thing I can think of is to (1) print the physical card then (2) immediately save the card image as PDF and then (3) use some sort of a converter to convert the PDF to a JPG. Imagemagick is the only program that converts this way (I think) and has a command line interface.

    Has anyone tried anything like this before?
    Finian

    #2
    Re: Create a JPG/Imagemagick

    Hi Finian,
    Usually I'm able to track you thought's but I'm am pretty lost with this one.

    ...why can't we just create the JPG ourselves?"
    We can't print to JPG like we can to a PDF, so what to do?
    ..print the physical card then (2) immediately save the card image as PDF and then (3) use some sort of a converter to convert the PDF to a JPG.
    I'm a little confused about what you are trying to accomplish. Are you trying to store the all card images as jpg and then produce the cards as pdf?
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

    Comment


      #3
      Re: Create a JPG/Imagemagick

      Is this one of those moments where technology that was useful and used routinely and fast (camera feeds with twain), would do you well instead of current technology (scanning ) which is time consuming and inneficient?
      Mike W
      __________________________
      "I rebel in at least small things to express to the world that I have not completely surrendered"

      Comment


        #4
        Re: Create a JPG/Imagemagick

        They are a recycling business and in Texas, you can only be paid cash for metals if you have a cash transaction Card. The cards are issued by the recycling yards and we accept cards from dozens of companies.

        We are required to examine/verify every cash card that is presented for every ticket. We insert a scanned image of the card presented (a customer could have 2 or 3 current cash cards) into the ticket and would prefer not to have to scan every time we need the image. For our own cards, we want to avoid even that first scan, hence my desire to create the image, without scanning, at the time we create the card we mail to the customer. If you have card applications from 50 customers that need to be mailed, it substantially increases the time spent getting the cards out if we have to scan them as well.

        So my idea is that our print button will print directly to the ID card printer (which we do now), but then save the card report as a PDF, just to be able to convert the pdf "image" to jpg. We won't store the pdf, all I'm interested in is getting the card from my Alpha report into a jpg as easily as I can. AFAIK, and I could be wrong, there isn't a way to do this directly from inside Alpha.
        Finian

        Comment


          #5
          Re: Create a JPG/Imagemagick

          Hi Finian,
          I'm trying to get a handle on your situation. I deal with a tremendous number of image file exchanges in lots of formats, and I might be able to help or not.

          You can only be paid cash for metals if you have a cash transaction Card. The cards are issued by the recycling yards and we accept cards from dozens of companies.
          So you are the company that accepts the cards and makes payments?
          We insert a scanned image of the card presented (a customer could have 2 or 3 current cash cards) into the ticket and would prefer not to have to scan every time we need the image.
          So these are cards that are multiple-use cards? The yards don't give a virgin card with each delivery and the card holder gives you a single use card and you give them the cash and transaction and card done? The card is returned to the holder and can be "recharged' at the yard and brought back to you "recharged" with a new payment amount?
          For our own cards,
          So you are both a yard and a payment center?
          Mike W
          __________________________
          "I rebel in at least small things to express to the world that I have not completely surrendered"

          Comment


            #6
            Re: Create a JPG/Imagemagick

            Finian, I am a bit late on this, but I am involved in summat similar. I import jpeg images to a form, create a report document and save as pdf.
            Can you not save as pdf and also as jpg/jpeg whatever?

            Edit, no you cannot easily.
            One way is using the Snipping Tool to select the document/image as a jpg which seems to be the default setting
            Then save wherever.

            'Open program: C:\Windows\Sysnative\SnippingTool.exe
            if file.exists("C:\Windows\Sysnative\SnippingTool.exe") then
            sys_shell("C:\Windows\Sysnative\SnippingTool.exe ",1)
            else
            ui_msg_box("Error Opening Program","File 'C:\Windows\Sysnative\SnippingTool.exe' does not exist.",ui_stop_symbol)
            end if

            I added this on a process to save the Pdf document button after verification is was correct, The PDF is saved, and the snipping tool fires next.
            If you need to save as a particular JPG file name, you can always set the Save to Clipboard to a constructed variable which the user can Ctrl+v into the name field;
            <FIELD>.VALUE_PUT( Field_Value as A [, Clipboard_Format as N ] )


            Saving as HTML or RTF works too, but sizing for JPG's is an issue.
            Last edited by Ted Giles; 11-09-2017, 09:01 AM.
            See our Hybrid Option here;
            https://hybridapps.example-software.com/


            Apologies to anyone I haven't managed to upset yet.
            You are held in a queue and I will get to you soon.

            Comment


              #7
              Re: Create a JPG/Imagemagick

              Are you printing the cards one at a time or is the report a multipage report?

              I just did some testing and you can use the onprintexit event, when previewing a report, to capture a jpg of a specified area of the preview screen. It might take some doing to determine the proper area of the screen to capture and I don't know how it would perform on different monitors but this seems to work. I am also unsure if this would be any time savings - having to preview each card individually.

              Code:
              dim b1 as B
              ui_bitmap_create_from_screen("test", 2, 2, 4, 3)
              b1 = ui_bitmap_save("test")
              my_jpeg = bitmap_to_jpeg(b1)
              ptr = file.create("c:\temp\somename.jpg", FILE_RW_EXCLUSIVE)
              ptr.writeb(my_jpeg)
              ptr.close()
              If you have a multipage report, since you are printing one card per page, you should be able to use the detail section onrecord event. Suppose there is an id field on the report.

              Code:
              ident = id.value
              dim b1 as B
              ui_bitmap_create_from_screen("test", 0, 0, 4, 3)
              b1 = ui_bitmap_save("test")
              my_jpeg = bitmap_to_jpeg(b1)
              ptr = file.create("c:\temp\\"+alltrim(ident)+".jpg", FILE_RW_EXCLUSIVE)
              ptr.writeb(my_jpeg)
              ptr.close()
              As you page through the preview of the report the above creates a jpg of the specified screen area named for each id.
              Last edited by Stan Mathews; 11-09-2017, 12:48 PM.
              There can be only one.

              Comment


                #8
                Re: Create a JPG/Imagemagick

                Thanks guys. I've been diverted from this for the past couple of days.

                Mike: we accept any current cash card presented. It can be from another yard, no problem. Once we get our own card into that person's hands, that's the card they usually use. We pay them for the metals they bring. In cash. The business is highly monitored. We upload details of every transaction, every day, with pictures, to a service used by all the local police departments

                Stan: not to confuse things but: there is an official card application, complete with picture, fingerprint, id images that we prepare and print to pdf and which we must retain. Until the customer gets the actual card, the application suffices to allow us to buy from them. We now print our own card direct to a dedicated card printer then print a label and mail the card. We are required to mail the card as a means of verifying the mailing address. So it's a single page document, but previewing/selecting wouldn't really work here. I need something that just happens. Thanks for the suggestion, though, I hadn't thought of that and it will come in handy elsewhere.

                Ted: thanks for the Snipping tool (sound like an implement of torture) idea. Do you happen to know if it can run without intervention? The card image, if we also saved it as a pdf, would be consistent in size. But this would only work if it can be automatic. I'll get the tool and start investigating.

                Mike: I'm looking for a flow that would go as follows: (1) print the card to the card printer then (2) save the card image as PDF so that (3) I can somehow convert that PDF to a JPG. I thought that ImageMagick would be the answer for step 3. It can certainly, according to examples and comments, do the conversion, but I can't get out of the gate. I get a "File Not Found" error no matter how I feed the ImageMagick "Convert" program.

                As soon as I can get to it, I'll reinstall ImageMagick with every option available, maybe I left something out. If anyone has used ImageMagick and can give me a clue about the "file not found" business I'd appreciate it. I'm certain that I'm passing in the correct file and path and can't understand why it's not working.
                Finian

                Comment


                  #9
                  Re: Create a JPG/Imagemagick

                  https://www.imagemagick.org/discours...ic.php?t=31529

                  Its about fnf.

                  Finian, the implement of torture is standard windows feature now. Not sure about automating unless you use a macro.
                  See our Hybrid Option here;
                  https://hybridapps.example-software.com/


                  Apologies to anyone I haven't managed to upset yet.
                  You are held in a queue and I will get to you soon.

                  Comment


                    #10
                    Re: Create a JPG/Imagemagick

                    it turns out the latest version of ImageMagick was fine, but I had not installed GhostScript which Imagemagick apparently uses in its conversions. Once I installed Ghostscript I was able to convert a PDF to a JPG so I can move ahead with coding the auto-run of the cmd file to actually do the conversion.

                    Here's the sample command line I used

                    magick -density 325 e:\temp5\test.pdf -resize 25% -background white -flatten e:\temp5\test.jpg

                    I show this in case anyone tries something similar. All the conversion examples I tried (until today) used the "Convert" command. That was incorrect for this later version of ImageMagick where you are expected to use the "Magick" command for conversions.

                    I'll be able to play with the conversion options once I see what the converted cash card file looks like.

                    Thanks to all for the suggestions and ideas.
                    Finian

                    Comment


                      #11
                      Re: Create a JPG/Imagemagick

                      Good stuff Finian
                      See our Hybrid Option here;
                      https://hybridapps.example-software.com/


                      Apologies to anyone I haven't managed to upset yet.
                      You are held in a queue and I will get to you soon.

                      Comment


                        #12
                        Re: Create a JPG/Imagemagick

                        Thanks Finian,
                        I'm headed to look into this myself.
                        Mike W
                        __________________________
                        "I rebel in at least small things to express to the world that I have not completely surrendered"

                        Comment


                          #13
                          Re: Create a JPG/Imagemagick

                          Full disclosure, this isn't working out quite as I hoped. I can convert PDF to JPG OK, but I hadn't really thought about what the PDF output looks like. Duh! It looks like a one page document and converts to look like that too. Now I have to figure out if/how an Imagemagick conversion can crop the 8.5X11 PDF image to something like 3X5 size and solve some font problems.
                          Finian

                          Comment


                            #14
                            Re: Create a JPG/Imagemagick

                            If you can convert pdf to image (png, jpg, bmp) then you can use some node library to easily manipulate this image if needed. For example Jimp.

                            You just need to write proper node_service (jimp.js) to use in Alpha. Like this (just example):

                            Code:
                            exports.handler = function(packet,response,sendResponse) {
                            	var e;
                                    var attachments = null;
                            	var Jimp = require("jimp");
                            	Jimp.read(packet.picture,function(err, image){
                            	image.resize(256,256).write("./smaller.jpg");
                            	})
                                // you can use msg to send  error or other msg back to xbasic 
                                var msg = "some message";
                                response.result = msg;
                                sendResponse(response,attachments);
                            };
                            And then call this service in xbasic script:

                            Code:
                            dim p as p
                            p.picture = "original.png"
                            dim Pout as p
                            Pout=node_request("jimp",p)
                            The result is 256px*256px picture smaller.jpg.

                            There are many other options in Jimp. to manipulate images.

                            Ken

                            Comment


                              #15
                              Re: Create a JPG/Imagemagick

                              Thanks Ken, that was an option I hadn't even considered. If/when I have time, I will return to the struggle where I "need to write proper node_service (jimp.js) to use in Alpha." This has, from the beginning, defeated my pretty superficial efforts to use node.js. All the examples and discussions assume more knowledge of Javascript than I possess and have left me stranded, so to speak. I'm still, off and on, trying to figure out how to do this with ImageMagick.
                              Finian

                              Comment

                              Working...
                              X