Cannot save picture as Jpeg in Windows

Hi everyone,
A piece of code that saves a picture as jpeg on the Mac is not working in windows. The code is:

p.Save(f, Picture.SaveAsJPEG, Picture.QualityMedium)

where p is a picture and I get an unsupported Format Exception. Getting in the exception it says that type 151 (SaveAsJPEG) is not supported in windows.

Is there a workaround to that? Why on earth saving as jpeg is not supported on windows.

I am just trying to scale down an image (load, scale it down and save it). Any other ideas?

Thank you very much in advance…

http://documentation.xojo.com/index.php/Picture
151 SaveAsJPEG JPEG Joint Photographics Expert Group. Supported on Windows only if GDI+ is installed.

Thanks Norman,
How do I install gdi+? I downloaded the api from Microsoft, but it is a set of directories (no installer).
Should I place the directory gdiplus in the Windows directory? (I am running Windows 8 64bit).
Or should I just put the .dll in the System 32 folder?

Windows 8 should have it

alternative: Use MBS Plugin to save JPEGs.

Christian hi,
Which plug-in should I use?

[quote=127836:@FOTIS GEORGIADIS]Thanks Norman,
How do I install gdi+? I downloaded the api from Microsoft, but it is a set of directories (no installer).
Should I place the directory gdiplus in the Windows directory? (I am running Windows 8 64bit).
Or should I just put the .dll in the System 32 folder?[/quote]
Hmm Windows 8 should already have it
Check if Use GDI plus is turned on for your app in the Windows build section

Could it be that it is 64bit? Should I do something?

What if GDI+ is off in the app?

Hi Tim,

I didn’t do anything, and I am running it from the IDE (not compiled yet). Should I do anything to “enable” it?

See what the Build Settings > Windows > Use GDI Plus setting is
If its off turn it on

[quote=127854:@Norman Palardy]See what the Build Settings > Windows > Use GDI Plus setting is
If its off turn it on[/quote]
It was indeed off. I turned it on, but I still get the unsupported format exception…

Some more info: I tried on another VM (Windows 7 32bit) and it worked perfectly, without turning “Use GDI Plus” On!
Should that happen?

GDI Plus has come with Windows since XP you only need to install it if you have Windows 2000.

I put UseGDIPlus = True in the App Open event and haven’t had an issue.

So far it seems to be something that is not working in Windows 8.
As I said, it works perfectly in Windows 7 (32bit). I tested it, compiled it, and the compiled application (which works on Win 7) fails with the unsupported format exception both in windows 8 64bit and in windows 8 32bit (it was compiled with UseGDIPlus=True).
I also tested it on a Windows 8.1 64 bit real PC (no VM) and it shows the same error!

If I find out anything else, I will post it…

If anyone has any solutions, please share.

Concerning the MBS Plugin, since I have them, I found the SaveAsJPEGMBS method, but it needs the picture to be bitmap, and I don’t know how to convert it to bitmap before I save it… Maybe Christian can say more about this…

normally picture is bitmap. The function should just work.

JPEGExporterMBS class has even more options:
http://monkeybreadsoftware.net/pluginpart-jpegcompression.shtml

That’s bitmap as opposed to vector graphics, not windows bitmap .BMP format.

Ok, I understand that. However, the image I read (to process) is jpeg, so it seems I need to convert it to bitmap. Otherwise the SaveAsJPEGMBS fails!

It shouldn’t. When you use OpenPicture on a JPEG, you get a bitmap image.

Thank you Tim. I will check it out again and see what happens.