Sha256: 0adff1ef9f046aa2ba843d565e0989c1a035e3f33f08c4c9b3931d42cb7d2992

Contents?: true

Size: 786 Bytes

Versions: 49

Compression:

Stored size: 786 Bytes

Contents

#
# Demonstrate the export_pixels and import_pixels methods.
#

require 'RMagick'
include Magick

puts <<END_INFO

This example demonstrates the export_pixels and import_pixels methods
by copying an image one row at a time. The result is an copy that
is identical to the original.

END_INFO

img = Image.read('../doc/ex/images/Gold_Statue.jpg').first
copy = Image.new(img.columns, img.rows);

begin
    img.rows.times { |r|
        scanline = img.export_pixels(0, r, img.columns, 1, "RGB");
        copy.import_pixels(0, r, img.columns, 1, "RGB", scanline);
        }
rescue NotImplementedError
    $stderr.puts "The export_pixels and import_pixels methods are not supported" +
                 " by this version of ImageMagick/GraphicsMagick"
    exit
end

copy.write("copy.gif")
exit

Version data entries

49 entries across 49 versions & 2 rubygems

Version Path
rmagick-2.13.4 examples/import_export.rb
rmagick-2.13.3 examples/import_export.rb
rmagick-2.13.3.rc1 examples/import_export.rb
rmagick-2.13.2 examples/import_export.rb
rdp-rmagick-0.0.0 examples/import_export.rb
rmagick-2.13.1 examples/import_export.rb
rmagick-2.12.2 examples/import_export.rb
rmagick-2.12.1 examples/import_export.rb
rmagick-2.12.0 examples/import_export.rb
rmagick-2.11.1 examples/import_export.rb
rmagick-2.10.0 examples/import_export.rb
rmagick-2.11.0 examples/import_export.rb
rmagick-1.15.1 examples/import_export.rb
rmagick-1.15.0 examples/import_export.rb
rmagick-1.14.1 examples/import_export.rb
rmagick-1.14.0 examples/import_export.rb
rmagick-1.15.10 examples/import_export.rb
rmagick-1.15.14 examples/import_export.rb
rmagick-1.15.15 examples/import_export.rb
rmagick-1.15.13 examples/import_export.rb