[img]Converting JPG to BMP fails with some JPG.[/img]

Just starting out? Need help? Post your questions and find answers here.
User avatar
CONVERT
Enthusiast
Enthusiast
Posts: 130
Joined: Fri May 02, 2003 12:19 pm
Location: France

[img]Converting JPG to BMP fails with some JPG.[/img]

Post by CONVERT »

I do not know if it's a bug or my mistake.

My program :

------------------------------------------------
UseJPEGImageDecoder()

GImage$ = "Dscn2727_recadre.jpg"

; GImage$ = "_affiche2721.jpg"

If LoadImage(0, GImage$) = 0
GLiberr$ = "Error reading " + GImage$
Else
imagebmp$ = "Wallpaperjc_tmp.bmp"
If SaveImage(0, imagebmp$, #PB_ImagePlugin_BMP) = 0
GLiberr$ = "Error writing from " + GImage$ + " to " + imagebmp$
Else
MessageRequester("","Good",0)
EndIf
EndIf

If GLiberr$ <> ""
MessageRequester("",GLiberr$,0)
EndIf

End
-------------------------------------------------
Generally, it works fine. But sometimes, a JPEG file makes the Saveimage fail. About 5 or 10 %.

These JPEG files are all made with a CoolPix 990, then worked with Ulead PhotoImpact 3.01, with "JPEG SmartSaver".

I select 2 cases : Dscn2727_recadre.jpg (saveimage fails) and _affiche2721.jpg (no problem).

You can find these pictures and the code at :
http://pg.ctjean.com/testpb/

Desactivate Debugger before F5. Sometimes, it halts.

Thanks if you find an explanation.
Jean.
Max.
Enthusiast
Enthusiast
Posts: 225
Joined: Fri Apr 25, 2003 8:39 pm

Post by Max. »

Did you try the library from http://www.purebasic.com/beta/?[/url]
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Looks like a problem with the BMP saver, rather than with the JPEG decoder. Maybe something to do with alignment or padding (the failing image is 1021x766).
El_Choni
User avatar
CONVERT
Enthusiast
Enthusiast
Posts: 130
Joined: Fri May 02, 2003 12:19 pm
Location: France

Post by CONVERT »

You are right.

It is a question of dimension.

I change from 1021 x 766 to 1024 x 768, and it works fine.

The same with 800 x 600.

Is it a bug of saveimage?

I ask this question to know if I try an other solution or if I wait for the correction.

Does the El Choni's beta library solve this problem?

Thanks a lot.
Jean.
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

My lib only decodes (and is no longer beta). The link Max has posted will drive you to a beta PureBasic library (not mine) of the JPEG plugin, which works ok, but which doesn't solve this problem, because it seems to have to do with BMP saving, not JPEG decoding.
El_Choni
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

I will take a look..
User avatar
geoff
Enthusiast
Enthusiast
Posts: 128
Joined: Sun Apr 27, 2003 12:01 am
Location: Cornwall UK
Contact:

Post by geoff »

I had trouble with SaveImage() to a BMP yesterday. I found that the bitmap header was saved but not the bitmap.

Unfortunately, when I tried to simplify the code to report a bug, the bug went away, so this may have been a bug in my program. I doubt this helps much. :?


Fred, do you know if the quality of loaded JPG images can be improved?
This has been asked elsewhere, but as things stand there seems no point developing software to load photographic quality images.
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

I will take look on the JPEG decoder options..
MeMyselfAndI
User
User
Posts: 10
Joined: Fri Apr 25, 2003 8:23 pm

Post by MeMyselfAndI »

Fred wrote:I will take look on the JPEG decoder options..
Sounds good enough :wink:

Would be great if the user could change the output quality.
.
. Greetings
.
. from all three of us...
.
Post Reply