Flex_Image Quality Option


#1

Installed flex_image yesterday for the first time, great and useful
plugin. However, the quality option doesn’t seem to work, I can
resize, add border … etc but can’t change the quality of the image.

Environment:
Windows XP
ruby 1.8.4 (2006-04-14) [i386-mswin32]
Rails 1.2.1
RadRails + Webrick
installed plugin using the following command:
ruby script/plugin install
http://beautifulpixel.com/svn/plugins/flex_image/


#2

Installed flex_image yesterday for the first time, great and useful
plugin. However, the quality option doesn’t seem to work, I can
resize, add border … etc but can’t change the quality of the image.

What image type are you outputting? I’m outputting a JPEG and :quality
works fine for me.


#3

Do you pull the original photo from the database then reduce the
quality before you output it to the client?
What I’m trying to do is reduce the quality before saving so I will
have a smaller file in my database. So, what I have in my model is
this

pre_process_image :size => ‘600x600’,
:quality => 50,
:border => {:size => 5, :color => ‘white’}

the size is reduced and the border is applied but the quality doesn’t
change.


#4

Why would you do that Philip, is it required that you have the
original image in the DB? and what about performance, are you caching?
I’m only thinking of doing the thumbnails on the run and I’m still
concerned about having performance issues. Can you share your
experience?


#5

Ahmad wrote:

Installed flex_image yesterday for the first time, great and useful
plugin. However, the quality option doesn’t seem to work, I can
resize, add border … etc but can’t change the quality of the image.

Environment:
Windows XP
ruby 1.8.4 (2006-04-14) [i386-mswin32]
Rails 1.2.1
RadRails + Webrick
installed plugin using the following command:
ruby script/plugin install
http://beautifulpixel.com/svn/plugins/flex_image/

The latest version of flex_image actually stores the file as a PNG in
the database/filesystem. The idea is prevent double compression of the
images, which can introduce some nasty artifacts along with higher file
sizes than necessary.

I obviously see the merit in your request, however. Therefore, PNG
storage format for master images, but now you can choose JPG instead. I
just checked in a feature that allows you to do this:

class FooPicture < FlexImage::Model
self.storage_format = :jpg
end

That should greatly reduce the size of the master image files.

-Alex


#6

Thank you Alex. Works perfectly I have 60K file now instead of 500K in
my DB.

On Feb 1, 9:05 pm, Alex W. removed_email_address@domain.invalid


#7

Do you pull the original photo from the database then reduce the
quality before you output it to the client?
What I’m trying to do is reduce the quality before saving so I will
have a smaller file in my database. So, what I have in my model is
this

Ah, I do it after that… when displaying to the client…


#8

Why would you do that Philip, is it required that you have the
original image in the DB? and what about performance, are you caching?
I’m only thinking of doing the thumbnails on the run and I’m still
concerned about having performance issues. Can you share your
experience?

I don’t store them in the DB, but in the filesystem, and I cache them
when
displayed so for me, I want the original simply so I have the best
possible image to work with should I decide later on to display them
even
larger, etc…

-p