Defining composite geometry using the mini-mage

Basically, I am trying to write this command using a mini_magic.

gm composite -compose Copy -geometry +0+210 note-transparent1.png note-rugby.png note-rugby-e.png 

This is my code:

  image = MiniMagick::Image.open("note-transparent1.png") result = image.composite(MiniMagick::Image.open("note-rugby.png") do |c| c.compose = "Copy" c.geometry = "+0+210" end) result.write "note-rugby-e.png" 

Images are compiled and written to a new file; however, geometry is not respected. Image is not offset.

I also tried setting the mini_magick processor to ImageMagick instead of GraphicsMagick, but I get the same result.

Any ideas?

+4
source share
2 answers

I am using mini_magick with ImageMagick and below code works for layout.

 bground = MiniMagick::Image.open("bground.jpg") image = MiniMagick::Image.open("image.jpg") result = bground.composite(image) do |c| c.gravity "NorthWest" c.geometry '400x400+20+56' end result.write "output.jpg" 
+3
source

According to rubydoc minimagic

 first_image = MiniMagick::Image.open "first.jpg" second_image = MiniMagick::Image.open "second.jpg" result = first_image.composite(second_image) do |c| c.compose "Over" # OverCompositeOp c.geometry "+20+20" # copy second_image onto first_image from (20, 20) end result.write "output.jpg" 
0
source

Source: https://habr.com/ru/post/1347957/


All Articles