Hi,
Currently I''m using the file_column plugin to upload images and save
multiple copies of each at 3 different resoltions:
file_column :name, :magick => {
:versions => { "thumb96" => "96x150>",
"medium250" =>
"250x400>", "large480" => "480X640>" }
}
I am wondering if there''s any way I can declare other rmagick options
at the same time, specifically the -quality attribute, since the
jpegs it outputs by default of very poor quality (serious compression
artifacts). I tried the following:
file_column :name, :magick => {
:quality => ''90'',
:versions => { "thumb96" => "96x150>",
"medium250" =>
"250x400>", "large480" => "480X640>" }
}
but it doesn''t seem to have any effect. Is it possible to send other
rmagick parameters to file_column if you are already using
the :versions option? If not, any ideas on how I could work around this?
Thanks,
Sean
Hi All,
Regarding the problem I was having below, after going through some of
the file_column source, it seems that only specific rmagick options
get processed, namely those that are hardcoded into the plugin by the
developer: :crop, :size and :versions. I was a little surprised
because the documentation seemed to imply that general rmagick
options could be passed via the options hash. Of course I am a newbie
to Ruby so I could just be reading the code wrong.
So, I want to modify the file_column source to ensure that when
images are resized they are saved with a higher quality jpeg
compression than is the default. In rmagick_file_column.rb, in the
resize_image method definition, I change the following:
if img_options[:size]
img = img.change_geometry(img_options[:size]) do |c, r, i|
i.resize(c, r)
end
to:
if img_options[:size]
img = img.change_geometry(img_options[:size]) do |c, r, i|
self.radial_blur = 15
i.resize(c, r)
end
I''ve just used radial_blur as a stand in rmagick method for now
because the results will be more readily apparent through visual
inspection than changing jpeg compression quality.
The change I made doesn''t seem to have any effect. Any ideas?
Thanks,
Sean
On 2-Feb-06, at 10:41 PM, Sean O''Hara wrote:
> Hi,
>
> Currently I''m using the file_column plugin to upload images and
> save multiple copies of each at 3 different resoltions:
> file_column :name, :magick => {
> :versions => { "thumb96" =>
"96x150>", "medium250" =>
> "250x400>", "large480" => "480X640>"
}
> }
>
> I am wondering if there''s any way I can declare other rmagick
> options at the same time, specifically the -quality attribute,
> since the jpegs it outputs by default of very poor quality (serious
> compression artifacts). I tried the following:
>
> file_column :name, :magick => {
> :quality => ''90'',
> :versions => { "thumb96" =>
"96x150>", "medium250" =>
> "250x400>", "large480" => "480X640>"
}
> }
> but it doesn''t seem to have any effect. Is it possible to send
> other rmagick parameters to file_column if you are already using
> the :versions option? If not, any ideas on how I could work around
> this?
>
> Thanks,
> Sean
>
>
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
Hi All,
Sorry for the noise on this lonely thread. I actually found an answer
to my problem. The quality setting has to be passed to the .write
method, which is called just after the resize method definition. I
changed it to this:
ensure
img.write(dest_path) { self.quality = 100 }
File.chmod options[:permissions], dest_path
end
The images look much better now.
Take care,
Sean
On 11-Feb-06, at 6:47 PM, Sean O''Hara wrote:
> Hi All,
>
> Regarding the problem I was having below, after going through some
> of the file_column source, it seems that only specific rmagick
> options get processed, namely those that are hardcoded into the
> plugin by the developer: :crop, :size and :versions. I was a little
> surprised because the documentation seemed to imply that general
> rmagick options could be passed via the options hash. Of course I
> am a newbie to Ruby so I could just be reading the code wrong.
>
> So, I want to modify the file_column source to ensure that when
> images are resized they are saved with a higher quality jpeg
> compression than is the default. In rmagick_file_column.rb, in the
> resize_image method definition, I change the following:
>
> if img_options[:size]
> img = img.change_geometry(img_options[:size]) do |c, r, i|
> i.resize(c, r)
> end
>
> to:
>
> if img_options[:size]
> img = img.change_geometry(img_options[:size]) do |c, r, i|
> self.radial_blur = 15
> i.resize(c, r)
> end
>
> I''ve just used radial_blur as a stand in rmagick method for now
> because the results will be more readily apparent through visual
> inspection than changing jpeg compression quality.
>
> The change I made doesn''t seem to have any effect. Any ideas?
>
> Thanks,
> Sean
>
>
> On 2-Feb-06, at 10:41 PM, Sean O''Hara wrote:
>
>> Hi,
>>
>> Currently I''m using the file_column plugin to upload images
and
>> save multiple copies of each at 3 different resoltions:
>> file_column :name, :magick => {
>> :versions => { "thumb96" =>
"96x150>", "medium250" =>
>> "250x400>", "large480" =>
"480X640>" }
>> }
>>
>> I am wondering if there''s any way I can declare other rmagick
>> options at the same time, specifically the -quality attribute,
>> since the jpegs it outputs by default of very poor quality
>> (serious compression artifacts). I tried the following:
>>
>> file_column :name, :magick => {
>> :quality => ''90'',
>> :versions => { "thumb96" =>
"96x150>", "medium250" =>
>> "250x400>", "large480" =>
"480X640>" }
>> }
>> but it doesn''t seem to have any effect. Is it possible to send
>> other rmagick parameters to file_column if you are already using
>> the :versions option? If not, any ideas on how I could work around
>> this?
>>
>> Thanks,
>> Sean
>>
>>
>>
>> _______________________________________________
>> Rails mailing list
>> Rails@lists.rubyonrails.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails
>>
>>
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
______________
ALIEN8 RECORDINGS
P.O. BOX 666, STATION R
MONTREAL, QC
CANADA, H2S 3L1
http://www.alien8recordings.com
Not sure if the post is anywhere active, but the tag does have support
for quality (and probably most other things) through the
''attributes''
parameters.
so you want to do something like
file_column :name, :magick => { :versions => { "thumb96" =>
"96x150>"
}, :attributes => { :size => 100 } }
Alien8 Recordings wrote:> Hi All,
>
> Sorry for the noise on this lonely thread. I actually found an answer
> to my problem. The quality setting has to be passed to the .write
> method, which is called just after the resize method definition. I
> changed it to this:
>
> ensure
> img.write(dest_path) { self.quality = 100 }
> File.chmod options[:permissions], dest_path
> end
>
> The images look much better now.
>
> Take care,
> Sean
>
>
> On 11-Feb-06, at 6:47 PM, Sean O''Hara wrote:
>
>> So, I want to modify the file_column source to ensure that when
>>
>> The change I made doesn''t seem to have any effect. Any ideas?
>>> save multiple copies of each at 3 different resoltions:
>>> file_column :name, :magick => {
>>> Sean
>> _______________________________________________
>> Rails mailing list
>> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
>> http://lists.rubyonrails.org/mailman/listinfo/rails
>>
>>
>
> ______________
> ALIEN8 RECORDINGS
> P.O. BOX 666, STATION R
> MONTREAL, QC
> CANADA, H2S 3L1
>
> http://www.alien8recordings.com
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---