Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GDI+ image class - storing PNGs stretched out
Message
 
To
05/11/2003 09:13:25
General information
Forum:
Visual FoxPro
Category:
Pictures and Image processing
Miscellaneous
Thread ID:
00846147
Message ID:
00846443
Views:
33
I have only small number of multipage images, and the following code prints all properties for my images:
For i = 0 TO img.GetPageCount() - 1
	img.SelectPage(i)
	?img.ImageFormat
	?img.ImageHeight
	?img.ImageWidth
	?img.HorizontalResolution
	?img.VerticalResolution
	img.SaveAsTIFF("page" + Transform(i))
EndFor
Can you send me a sample image?


>Alexander,
>
>I appreciate the response! Your GDIPLUS wrapper is phenomenol...if anyone can help it will probably be you!
>
>The weird thing about the bad images is that the image properties show nothing:
>
>loImg.ImageFormat = ""
>loImg.ImageHeight = 0
>loImg.ImageWidth = 0
>loImg.HorizontalResolution = 0.0
>loImg.VerticalResolution = 0.0
>
>Actually, even for good TIFs all of the image information is empty.
>
>Well, it appears any image I process is showing empty image properties. But the images save off as separate pages the way they are supposed to. Here is the code I use to split pages out into temporary page files (that I then store in database):
>
>
>loInit = NEWOBJECT("gpInit", "gpImage.PRG")
>loImg = NEWOBJECT("gpImage", "gpImage.PRG")
>* Store each page of TIFF as separate file
>loImg.Load(pcFile)
>* Some graphics formats will return zero pages.  But there will always be at least
>* one, and subsequent commands work fine.  So, make sure lnPages is at least 1
>lnPages = MAX(loImg.GetPageCount(), 1)
>FOR i = 0 TO lnPages - 1
>	loImg.SelectPage(i)
>         * (Here is where I check the loImg properties)
>	loImg.SaveAsTIFF(ADDBS(pcSplitDir) + pcSplitFilePrefix + TRANSFORM(i))
>ENDFOR	
>
>
>As you can see, it is after I call SelectPage that I check the image properties, and the properties are all empty or zero.
>
>At first I thought it was something with the GDI wrapper causing the problem, and that was why the properties were empty. But then I looked at the file saved off from Outlook and saw that some TIFs were already stretched out and others weren't. As I said in my follow-up post, all TIFs saved out of Outlook look fine when viewed with a TIF viewer such as Microsoft Office Document Imaging. But when using a standard graphics viewer (like Microsoft Office Picture Manager), some TIFs look stretched out while others look fine. We have to use a standard viewer (we use a Pegasus OCX in our production system), as our graphics include TIFs, JPGs, PNGs, etc.
>
>I e-mailed "good" and "bad" TIFs to the other gentleman who responded to this post, so maybe he can see the difference between the TIFs.
>
>Would you have any idea why the GDI wrapper would be returning empty or zero image properties? Any help would be greatly appreciated!
>
>Thanks,
>JoeK
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform