Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Correctly save image to solve "Invalid picture" problem

Status
Not open for further replies.

SuperMoonster

Programmer
Aug 11, 2005
59
BR
Hello everybody,

I'm having trouble in a system I'm working on. I receive some images from a customer in a different format (SGD extension, created by the customer). I want to load this image in a PictureBox to resize them, but I get a "Invalid Picture" error. I've tested and checked that if I enter Ms Paint and re-save the image as JPG (instead of renaming it, as I was doing) the error will not occur. So, what I need to do is resave it programatically.

Does anybody know how to do it?

Thanks
 
From VB Help - LoadPicture Function

'Graphics formats recognized by Visual Basic include bitmap (.bmp) files, icon (.ico) files, cursor (.cur) files, run-length encoded (.rle) files, metafile (.wmf) files, enhanced metafiles (.emf), GIF (.gif) files, and JPEG (.jpg) files.'

Have you tried manually replacing the SGD extension with all those listed above. e.g the files could be bitmaps (.bmp).

regards Hugh,

 
That's exactly the problem: it doesn't work.
I've tried renaming it to: JPG, PNG, BMP, WMF, EMF, TIF, RLE, GIF, and even CUR and ICO.

Nothing makes pictureBox load the image. It will only load it when I open paint and re-save it (in any of the accepted extensions). So I suppose I need to convert it.
 
<<So I suppose I need to convert it.>>

Looks like it.

A quick Google indicates you may be working with Star Office Gallery Image files there.

Hugh,
 
Some more information: I just found out that the file comes in a TIFF format, although with another extension. So what I need to do is convert from TIFF to JPEG.

Anyone can help?
 
Yuck ... a quick search in this forum will find some substantially easier solutions than one that requires a 3rd party library and C code to work ...

For example: thread222-1182980 (which provides further links). I also have an easy WIA solution as well, which I'm pretty sure that I posted here
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top