Compressing files

Hello,

i want to show the jpeg-compression data loss on different images…

for this purpose I’m trying to save an image several times with a ruby
(rmagick) script. The problem is: the image is compressed once and there
is no data loss after the first saving…

Here is the code I’m trying to work with. What could be wrong? How can I
change the code, that there is a difference in saving 7 times or 18
times…f.e.

$i = 1
$num = 700

while $i < $num do

puts $i

img = Image.read(“mypath/line1.jpeg”).first
img.rotate!(90)
img.write(“mypath/line1.jpeg”){ self.quality = 50 }
img.destroy!
img = nil
GC.start

$i +=1
end

Thanks

Adriana

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs