I am trying to dynamically set the compression or quality of an image when displaying it. I have seen in the RMagick documentation how to set the quality only when writing the file to disk. How can I set the quality dynamically or set the compression? The method "image.quality=" does not exist and "image.compression_type=" is not in the documentation. I have tried image.compression= Magick::CompressionType.new(''JPEGCompression'',50), but that doesn''t work. Thanks! --Tom --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Okay, I''ve figured out how to set the quality with the .to_blob method: image.to_blob { self.quality=50 } That will let me do what I am trying to do. If there are any RMagick pros out there, I still would like to know 1) How can you change the JPEGCompression? It looks like it is always set to 5. 2) What is the difference between setting the JPEGCompression and Quality? Is one better than the other? Thanks, Tom On May 16, 1:39 pm, TomRossi7 <t...-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote:> I am trying to dynamically set the compression or quality of an image > when displaying it. I have seen in the RMagick documentation how to > set the quality only when writing the file to disk. How can I set the > quality dynamically or set the compression? > > The method "image.quality=" does not exist and > "image.compression_type=" is not in the documentation. I have tried > image.compression= Magick::CompressionType.new(''JPEGCompression'',50), > but that doesn''t work. > > Thanks! > > --Tom--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
img.write("image.jpg"){self.quality = 75} :) On 5/16/07, TomRossi7 <tom-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote:> > > Okay, I''ve figured out how to set the quality with the .to_blob > method: > > image.to_blob { self.quality=50 } > > That will let me do what I am trying to do. If there are any RMagick > pros out there, I still would like to know > 1) How can you change the JPEGCompression? It looks like it is always > set to 5. > 2) What is the difference between setting the JPEGCompression and > Quality? Is one better than the other? > > Thanks, > Tom > > > On May 16, 1:39 pm, TomRossi7 <t...-5bxIUPmzHicFraO2wh7vUA@public.gmane.org> wrote: > > I am trying to dynamically set the compression or quality of an image > > when displaying it. I have seen in the RMagick documentation how to > > set the quality only when writing the file to disk. How can I set the > > quality dynamically or set the compression? > > > > The method "image.quality=" does not exist and > > "image.compression_type=" is not in the documentation. I have tried > > image.compression= Magick::CompressionType.new(''JPEGCompression'',50), > > but that doesn''t work. > > > > Thanks! > > > > --Tom > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---