What quality settings are used for the 'resize' images ?

SeesCandy
SeesCandy's picture

Joined: 2013-06-18
Posts: 26
Posted: Wed, 2014-01-22 09:03

Hello.

Gallery 3.09
Linux 3.11-2-amd64
Graphics toolkit: imagemagick

I understand that if I upload a 1024 wide image, and make the max image size setting match,
a 'copy' or 'resize' image will be created for each image.

In this circumstance, is the 'resize' image an exact copy ?

What method and what setting is used to make the 'resize' image...
i.e. jpeg compression setting, quality conversion setting of
lanczos, Lagrange... etc.

Can I assign the quality compression and method used to make the 'resize' copy images ?

Also, can I make my own thumbnails if they are identically matched in size, and replace G3 thumbs ?

Thank you.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2014-01-22 14:33
Quote:
In this circumstance, is the 'resize' image an exact copy ?

Not exact. Depending on the image toolkit.....
There is 2 advanced settings you can change:
image_sharpen the default is 15
and
image_quality the default is 75

The quality depends on the image toolkit as well.

Quote:
Also, can I make my own thumbnails if they are identically matched in size, and replace G3 thumbs ?

If I understand your question then yes if the aspect ratio and size are the same. I'm assuming you want a different crop?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
SeesCandy
SeesCandy's picture

Joined: 2013-06-18
Posts: 26
Posted: Wed, 2014-01-22 17:58

Floridave...

Using Imagemagick toolkit.

Which command function is gallery using for sharpen and quality please ?

Regarding thumbnails, not a different crop, increased quality... is the
quality setting accessible via gallery as well ?

Cheers.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2014-01-22 19:13
Quote:
Which command function is gallery using for sharpen and quality please ?

Sharpen and quality is from the kohana library:
gallery3/system/libraries/drivers/ImageMagic.php
public function sharpen($amount) and public function process() there is quality settings as well.

Quote:
quality setting accessible via gallery as well ?

Yes via the advanced settings.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
SeesCandy
SeesCandy's picture

Joined: 2013-06-18
Posts: 26
Posted: Wed, 2014-01-22 20:13

Thanks for the quick reply Floridave.

I'm using Gallery 3 from inmotionhosting.com.

They offer imagemagick and gd as graphics toolkits for use with Gallery3.

Is it possible to use an imagemagick standard command with Gallery3 such as;

convert original.jpg -colorspace RGB -filter Cosine -resize 1024 -colorspace sRGB result.jpg

Thank you.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2014-01-22 20:15

You would have to look though the code for the convert function Kohana uses to customize to what your after.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
SeesCandy
SeesCandy's picture

Joined: 2013-06-18
Posts: 26
Posted: Thu, 2014-01-23 01:14

OK, thanks again Floridave.

Is that possible for both the resize and thumbnail images ?

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Thu, 2014-01-23 01:53

I sure could use some See's Lolli-pops!

Just sayin'!

 
SeesCandy
SeesCandy's picture

Joined: 2013-06-18
Posts: 26
Posted: Tue, 2014-01-28 04:03

Excuse me Floridave...

There is no: gallery3/system/libraries/drivers/ImageMagic.php
Do you mean ?: gallery3/system/libraries/drivers/Image/ImageMagic.php

If I grep for the word 'resize', I get this...
$ grep resize ImageMagic.php

public function resize($prop)
if ($error = exec(escapeshellcmd($this->dir.'convert'.$this->ext).' -background '.$this->background.' -flatten -resize '.$dim.' '.$this->cmd_image.' '.$this->cmd_image))

Question: Is this the line I need to modify to incorporate the;
convert original.jpg -colorspace RGB -filter Cosine -resize 1024 -colorspace sRGB result.jpg

Thanks again.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2014-01-28 05:53
Quote:
Do you mean ?: gallery3/system/libraries/drivers/Image/ImageMagic.php

Yes.

looks to me like the command you would want to edit to add your customization. Depending on the IM version, some options might not be available. Speed might be an issue to consider as well with different options/operations.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
SeesCandy
SeesCandy's picture

Joined: 2013-06-18
Posts: 26
Posted: Tue, 2014-01-28 14:47

Excuse me Floridave but,

Is there a link somewhere that details the procedure to change ImageMagic.php to
incorporate the 'convert original.jpg -colorspace RGB -filter Cosine -resize 1024 -colorspace sRGB result.jpg' ?

If I understand correctly, the line 'public function resize($prop) is the correct line to modify.

Thank you.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2014-01-29 00:34
Quote:
Is there a link somewhere

Sorry no. It is a kohana 3rd party code that we use.

try to modify that line and see how far you get. I would start like:
if ($error = exec(escapeshellcmd($this->dir.'convert'.$this->ext).' -colorspace RGB -filter Cosine -background '.$this->background.' -flatten -resize '.$dim.' '.$this->cmd_image.' '.$this->cmd_image))

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
SeesCandy
SeesCandy's picture

Joined: 2013-06-18
Posts: 26
Posted: Wed, 2014-01-29 13:22

Will do...

I'll try your 'convert' modification suggestion.

Thank you for the help.

[SOLVED]

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2014-01-29 18:04
Quote:
[SOLVED]

And your results for the benifit of others?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
SeesCandy
SeesCandy's picture

Joined: 2013-06-18
Posts: 26
Posted: Thu, 2014-01-30 04:24

Floridave,

I've had a high level of success with dramatically increasing the
quality of my resizes over anything Photoshop offers, using imagemagick.
I've reduced 4000 pixel wide images to 1024 without halos and maintained
acceptable levels of sharpness.

I love Gallery3 and I'm always interested in elevating any ability to
customize and increase the quality of the images displayed... which
unfortunately at the moment is automatic.

I would love to participate in achieving my objective (using imagemagick)
to customize the quality of the 'resized' image Gallery3 automatically
produces... but your proposed solution is a theory at the moment and
beyond my programming.

It's my opinion a person in your position of connection
to this project and your level of programming experience
could offer a substantial amount of benefit to us as users
if you achieve resolution to your proposed solution.

It would be of great benefit to all Gallery3 users to posses a
working method to increase and/or customize the quality Gallery3
automatically generates in the 'resize' images it automatically produces,
with imagemagick.

Thanks again.

Cheers.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2014-01-31 02:09

Have you seen
http://codex.galleryproject.org/Gallery3:Modules:image_optimizer

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
SeesCandy
SeesCandy's picture

Joined: 2013-06-18
Posts: 26
Posted: Fri, 2014-01-31 05:24

Floridave, thanks for the link.

You'll let us know if you ever successfully achieve your
manual code change to ImageMagic.php as suggested eh?

All the best.

 
SeesCandy
SeesCandy's picture

Joined: 2013-06-18
Posts: 26
Posted: Sun, 2014-02-02 18:57

Floridave...

Some preliminary results to share.

I've tried your theory and changed the ImageMagick.php to;

if ($error = exec(escapeshellcmd($this->dir.'convert'.$this->ext).' -colorspace RGB -filter Lagrange -background '.$this->background.' -flatten -resize -colorspace sRGB '.$dim.' '.$this->cmd_image.' '.$this->cmd_image))

I added;
-colorspace RGB -filter Lagrange
-colorspace sRGB

I didn't rebuild any images, I"m hoping this is done 'on the fly' and if so,
my changes apparently didn't break anything, it still works when I click on a thumbnail to show
a 'resize' image, and when I click on the 'resize' it shows the original image I uploaded.

1. Can I have G3 log resizes so I can see if it's working ?
2. There are other sections mentioning 'convert', should I change those also ?
3. Will these changes to ImageMagick.php also apply to thumbnail creation ?

Thank you.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2014-02-02 19:35
Quote:
I didn't rebuild any images, I"m hoping this is done 'on the fly'

i don't think we call resize for every view just when we add items or rebuild them.

Quote:
1. Can I have G3 log resizes so I can see if it's working ?

I don't understand you would have to look at the resize results in the var directory.

Quote:
2. There are other sections mentioning 'convert', should I change those also ?

Your guess is as good as mine. See what the results are first.

Quote:
3. Will these changes to ImageMagick.php also apply to thumbnail creation ?

Yes I believe so.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team