View Single Post
Old 06-11-2009, 10:21 AM   #782
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,560
Karma: 20150435
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by tompe View Post
There is a flag "--imagerescale 0" which I think will disable all scaling. I checked th code now and from the code without actually testing I draw that conclusion (so i might be wrong...).
I think you are wrong.

In MobiPerl/Util.pm, there's this:

Code:
    # pdurrant
    # do not resize large images if the filesize is OK,
    # even if pixel dimensions are large
    if ($filesize < $maxsize and
       ((not $rescale_large_images) || ($x <= $maxwidth and $y <= maxheight))
       and $type ne "PNG"
       and (not defined $scale_factor or $scale_factor == 1.0)) {

       # No transformation has to be done, keep data as is
       ...
    }
That's where I want the program to enter, but the condition is "if $filesize < $maxsize" and other things. I want that even if the filesize is larger, so I had to modify the if and make it:

Code:
    if (($filesize < $maxsize and
        ((not $rescale_large_images) || ($x <= $maxwidth and $y <= $maxheight))
        and $type ne "PNG"
        and (not defined $scale_factor or $scale_factor == 1.0)) or (not $rescale_large_images)) {
which is not perfect (it won't touch PNGs, which it should), but it works for me.
Jellby is offline   Reply With Quote