[Top][All Lists]

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

Re: NSImageCompressionFactor

From: Lundberg, Johannes
Subject: Re: NSImageCompressionFactor
Date: Thu, 22 May 2014 06:13:38 +0900


On Wednesday, May 21, 2014, Riccardo Mottola <address@hidden> wrote:

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!


Johannes Lundberg

CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
reply via email to

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