Poor Jpg Quality - SaveImage, #PB_ImagePlugin_JPEG

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Poor Jpg Quality - SaveImage, #PB_ImagePlugin_JPEG

Post by c4s »

What I meant is that if the text is saved with less quality (than it is actually possible by the way!), then photos with high contrast will look bad too.

I think PureBasic should simply switch to a better encoding algorithm similar as e.g. Photoshop does.


Edit: luis said it a little better. :wink:
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
nase09
User
User
Posts: 33
Joined: Sat Jun 07, 2008 11:45 am

Re: Poor Jpg Quality - SaveImage, #PB_ImagePlugin_JPEG

Post by nase09 »

yep - the Text 'Test-Image' is for testing only (when saved to jpg you see that there's something wrong easily).
Originally I discovered the problem with a (more real life 8)) Photo.

And I'm sure there is a good solution for this. (Example: Using 'LibJPEG none chroma-subsampling (4:4:4)' when saving jpg with quality>=8), or how about an additional Flag (already mentioned by Luis) for SaveImage() e.g. #PB_Image_Subsampling_None)
I hope my 4th post in this thread helps Fred to do what has to be done.
Last edited by nase09 on Sun Dec 30, 2012 5:44 pm, edited 2 times in total.
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: Poor Jpg Quality - SaveImage, #PB_ImagePlugin_JPEG

Post by MachineCode »

luis wrote:For example a photographic image of a beautiful sunset with a road sign in the image.
Oooh, good comeback. :) I have no argument now. ;)
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
User avatar
nase09
User
User
Posts: 33
Joined: Sat Jun 07, 2008 11:45 am

Re: Poor Jpg Quality - SaveImage, #PB_ImagePlugin_JPEG

Post by nase09 »

MachineCode wrote:Oooh, good comeback. :) I have no argument now. ;)
Some time ago there was a strange guy called Maya.
He developed a handy little calendar-tool, able to calculate Doomsday (and it shows all years statutory holidays, too!).
Of course he used Purebasic.
Unfortunately he saved the calendar's output as jpg to mail it to my aunt's daughter. The poor little girly was pretty upset: "Doomsday is 21.12.2012!!".
I said to her "wait a minute, this jpg looks strange - pretty crabbed.. are you sure this is a '1' .. this jpg contains text - it should have been saved as PNG!".
But too late. The last few weeks were terrible. My aunt's daughter almost got mad - told all of her friends to prepare for the end, and my mother (and even my neighbor's cat!) almost got mental breakdown, and my grandpa didn't stop yelling "WE'RE ALL GONNA DIEEE!!"..
(But seriously: most people here know the benefits of the different image formats. But e.g. sometimes you're limited to one single file format (jpg), and e.g. sometimes saving as PNG is no option (cause png support is pretty rare). The jpeg format CAN deliver excellent quality - so why not using it)
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Re: Poor Jpg Quality - SaveImage, #PB_ImagePlugin_JPEG

Post by djes »

nase09 wrote:
MachineCode wrote:Oooh, good comeback. :) I have no argument now. ;)
Some time ago there was a strange guy called Maya.
He developed a handy little calendar-tool, able to calculate Doomsday (and it shows all years statutory holidays, too!).
Of course he used Purebasic.
Unfortunately he saved the calendar's output as jpg to mail it to my aunt's daughter. The poor little girly was pretty upset: "Doomsday is 21.12.2012!!".
I said to her "wait a minute, this jpg looks strange - pretty crabbed.. are you sure this is a '1' .. this jpg contains text - it should have been saved as PNG!".
But too late. The last few weeks were terrible. My aunt's daughter almost got mad - told all of her friends to prepare for the end, and my mother (and even my neighbor's cat!) almost got mental breakdown, and my grandpa didn't stop yelling "WE'RE ALL GONNA DIEEE!!"..
(But seriously: most people here know the benefits of the different image formats. But e.g. sometimes you're limited to one single file format (jpg), and e.g. sometimes saving as PNG is no option (cause png support is pretty rare). The jpeg format CAN deliver excellent quality - so why not using it)
:lol:
User avatar
nase09
User
User
Posts: 33
Joined: Sat Jun 07, 2008 11:45 am

Re: Poor Jpg Quality - SaveImage, #PB_ImagePlugin_JPEG

Post by nase09 »

Fred wrote:We use standard libjpeg so I don't know why the results are bad.
Dear Fred, thank you for the improvements in v5.10.
But I'm a little disappointed, cause I really need accurate jpeg output.
You didnt answer my message, I'm sure you're too busy, but now after release of 5.10 final..
please check it out - as mentioned .."Using LibJPEG none chroma-subsampling (4:4:4)" should solve the problem.
(Or am I missing something ?)

Image output is a pretty important feature, I hope "We use standard libjpeg so I don't know why the results are bad." is not your final word.
Last edited by nase09 on Fri Mar 08, 2013 2:36 am, edited 1 time in total.
Thorium
Addict
Addict
Posts: 1305
Joined: Sat Aug 15, 2009 6:59 pm

Re: Poor Jpg Quality - SaveImage, #PB_ImagePlugin_JPEG

Post by Thorium »

You may be better of using libjpeg directly yourself. Image saving in PB isnt very great. It's ok, but if you need something fancy you need to go deeper. Same goes for PNG. Naturally you dont have a quallity lose in PNG, but PNG's saved with PB are much bigger than saved with other software because PB does not utilize the PNG filters.
User avatar
nase09
User
User
Posts: 33
Joined: Sat Jun 07, 2008 11:45 am

Re: Poor Jpg Quality - SaveImage, #PB_ImagePlugin_JPEG

Post by nase09 »

Thorium wrote:You may be better of using libjpeg directly yourself. Image saving in PB isnt very great. It's ok, but if you need something fancy you need to go deeper. Same goes for PNG. Naturally you dont have a quallity lose in PNG, but PNG's saved with PB are much bigger than saved with other software because PB does not utilize the PNG filters.
ok, this would be a workaround.. but very unconvenient..

I still hope for added SaveImage-functionality in Purebasic. (Regarding jpegs, and yes, what an excellent opportunity to set one's hand to the PNG-sector as well :wink: )
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Poor Jpg Quality - SaveImage, #PB_ImagePlugin_JPEG

Post by Michael Vogel »

There's a great difference (in size and quality) between the available quality levels, ia there any chance to get a better granularity (percents) for the jpeg quality parameter?

It's not a big deal to adapt old/new code to work with all compiler versions...

Code: Select all

; Example to adapt old source code...
CompilerIf #PB_Compiler_Version<520
 #JPEGQualityFactor=1
CompilerElse
 #JPEGQualityFactor=10
CompilerEndif

SaveImage(...,quality*#JPEGQualityFactor)
Post Reply