[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSImageCompressionFactor

From: Riccardo Mottola
Subject: Re: NSImageCompressionFactor
Date: Wed, 21 May 2014 16:56:11 +0200
User-agent: Mozilla/5.0 (X11; FreeBSD i386; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24


Lundberg, Johannes wrote:
Well, the GNUstep documentation clearly states that it is from 0 - 255 so maybe it something that Apple changed recently? We also have to update the documentation and think about all the programs we will break if changing the functionality...

I found this code in our JPEG handling:

  if (qualityNumber != nil)
      quality = (int) ((1-[qualityNumber floatValue] / 255.0) * 100.0);

it is clearly expecting something between 0 and 255 and in "reversed" way, since Cocoa states that 0 is lowest quality, 1 highest.

This assumption (and back-and-forth conversion) is all over NSBitmapImageRep.

I fixed that to my best. Please try!

Maybe I have forgotten something elsewhere.

Now, in PRICE, if I compress the same image with different settings, I do get:

-rw-r--r--  1 multix  staff   14751 May 21 16:44 linhof_00.jpg
-rw-r--r--  1 multix  staff  451980 May 21 16:46 linhof_100.jpg
-rw-r--r--  1 multix  staff   41743 May 21 16:44 linhof_25.jpg
-rw-r--r--  1 multix  staff   86293 May 21 16:44 linhof_75.jpg
-rw-r--r--  1 multix  staff  355566 May 21 16:46 linhof_98.jpg

which looks much more reasonable than before!


reply via email to

[Prev in Thread] Current Thread [Next in Thread]