Forum: Ruby on Rails Flex_Image Quality Option

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C041c0b87f840fe5b9145a0e9961d6ec?d=identicon&s=25 Ahmad (Guest)
on 2007-01-31 10:34
(Received via mailing list)
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/
2f9a03aa0fcfe945229cb6126eda2cb2?d=identicon&s=25 Philip Hallstrom (Guest)
on 2007-01-31 19:01
(Received via mailing list)
> 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.
C041c0b87f840fe5b9145a0e9961d6ec?d=identicon&s=25 Ahmad (Guest)
on 2007-01-31 21:51
(Received via mailing list)
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.
2f9a03aa0fcfe945229cb6126eda2cb2?d=identicon&s=25 Philip Hallstrom (Guest)
on 2007-02-01 00:33
(Received via mailing list)
> 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...
C041c0b87f840fe5b9145a0e9961d6ec?d=identicon&s=25 Ahmad (Guest)
on 2007-02-01 10:03
(Received via mailing list)
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?
D0cd6b10e01bacb976b3b815a9c660bc?d=identicon&s=25 Alex Wayne (squeegy)
on 2007-02-01 19:05
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
C041c0b87f840fe5b9145a0e9961d6ec?d=identicon&s=25 Ahmad (Guest)
on 2007-02-01 21:19
(Received via mailing list)
Thank you Alex. Works perfectly I have 60K file now instead of 500K in
my DB.


On Feb 1, 9:05 pm, Alex Wayne <rails-mailing-l...@andreas-s.net>
2f9a03aa0fcfe945229cb6126eda2cb2?d=identicon&s=25 Philip Hallstrom (Guest)
on 2007-02-01 22:15
(Received via mailing list)
> 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
This topic is locked and can not be replied to.