Problem with only some JPG's created from Image Magick
Posted: 2011-02-23T06:51:05-07:00
I am creating JPG's as thumbnails from PDF documents. I am then loading those JPG's into an image control in a VB6 application to give the user a preview of the PDF. The problem I am having is that some of the JPG's are not loadable into the VB6 image control, and I narrowed it down to something with the JPG file itself, or possibly the original PDF source file. Either way, I'm looking for any suggestions on anything I can change in my Image Magick processing command that might be able to resolve the problem.
To be clear, in all cases, Image Magick *does* create JPG's and they are viewable by double-clicking them in Windows, it's just that there is some difference in the JPG's created that they can't be displayed in a VB6 Image control, possibly due to differences in the source PDF's.
Environment:
Image Magick Version 6.6.7-5 2011-02-03 Q16
[Edit: GhostScript 9.0 also]
Development environment: VB6, WinXP
Included examples: (All are shared on 4shared.com; click the big blue button under the preview image to download the file.)
1) PDF1-GeneratesBadJPG.pdf - This is an example PDF that experiences the problem. (http://www.4shared.com/document/EcLEPlN ... adJPG.html)
2) JPG1-FromPDF1.JPG - This is the output JPG from my Image Magick command that experiences the problem of not loading into the VB6 image control.
(http://www.4shared.com/photo/HYriJMbH/J ... mPDF1.html)
3) PDF2-GeneratesGoodJPG.pdf - This is an example PDF that *does not* experience the problem. (http://www.4shared.com/document/iTiJDqO ... odJPG.html)
4) JPG2-FromPDF2.JPG - This is the output JPG from my Image Magick command that *does not* experience the problem. (http://www.4shared.com/photo/vwWdmEqB/J ... mPDF2.html)
Image Magick Command:
I did determine that when I compare the contents of the successful and unsuccessful JPG output files in a text editor, I noticed that right near the beginning of the file, there is the text "Adobe" in the ones that fail, and it does not exist in the ones that succeed.
NOTE: As a test, I ran the suspect PDF through another PDF print driver to create a new PDF file, then I generated a JPG image from the resulting PDF with Image Magick in the same manner as the others, and this resulting JPG worked fine. It loaded in the VB6 image control and it didn't have the "Adobe" text near the beginning of the file. So one possible resolution is to pre-process all PDF's using this print driver, but I really don't want to have to pre-process all PDF's before running them through IM.
Are there any suggestions to consistently process all PDF's through IM?
Thanks!
To be clear, in all cases, Image Magick *does* create JPG's and they are viewable by double-clicking them in Windows, it's just that there is some difference in the JPG's created that they can't be displayed in a VB6 Image control, possibly due to differences in the source PDF's.
Environment:
Image Magick Version 6.6.7-5 2011-02-03 Q16
[Edit: GhostScript 9.0 also]
Development environment: VB6, WinXP
Included examples: (All are shared on 4shared.com; click the big blue button under the preview image to download the file.)
1) PDF1-GeneratesBadJPG.pdf - This is an example PDF that experiences the problem. (http://www.4shared.com/document/EcLEPlN ... adJPG.html)
2) JPG1-FromPDF1.JPG - This is the output JPG from my Image Magick command that experiences the problem of not loading into the VB6 image control.
(http://www.4shared.com/photo/HYriJMbH/J ... mPDF1.html)
3) PDF2-GeneratesGoodJPG.pdf - This is an example PDF that *does not* experience the problem. (http://www.4shared.com/document/iTiJDqO ... odJPG.html)
4) JPG2-FromPDF2.JPG - This is the output JPG from my Image Magick command that *does not* experience the problem. (http://www.4shared.com/photo/vwWdmEqB/J ... mPDF2.html)
Image Magick Command:
Code: Select all
Convert.exe C:\Test\PDF1-GeneratesBadJPG.pdf[0-9] -scale 34% C:\Test\thumbnail.jpg
NOTE: As a test, I ran the suspect PDF through another PDF print driver to create a new PDF file, then I generated a JPG image from the resulting PDF with Image Magick in the same manner as the others, and this resulting JPG worked fine. It loaded in the VB6 image control and it didn't have the "Adobe" text near the beginning of the file. So one possible resolution is to pre-process all PDF's using this print driver, but I really don't want to have to pre-process all PDF's before running them through IM.
Are there any suggestions to consistently process all PDF's through IM?
Thanks!