Wood tiles overlay with multiply, offset & density

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
christiaan
Posts: 13
Joined: 2013-08-09T01:20:06-07:00
Authentication code: 6789

Wood tiles overlay with multiply, offset & density

Post by christiaan »

Hello,

I struggling with this issue. I have two files:
  • Source image (landscape) created with "convert" with -units PixelsPerInch at a density of 20
  • Wood vertical tile image @ 150 DPI
I need to overlay the source image with the wooden tiles next to each other in multiply mode, but I can't get it working. The tiles are way too big for the source image:

Code: Select all

composite \
-compose Multiply \
-tile wood.jpg \
source.jpg \ 
source.jpg
I need to scale down the tile to 20 DPI too, but I can't find a way of doing that.

Next to that problem I need to offset the tiles from the left and upper side.

How do I do this? I hope you guys can help me out here. Thanks in advance.

Below are the resources:
Last edited by christiaan on 2013-11-04T14:18:25-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Wood tiles overlay with multiply, offset & density

Post by snibgo »

Don't worry about DPI. ImageMagick works with image sizes in pixels, not DPI.

Offsets are usually done with "-geometry". Can you provide your input images (put them in dropbox.com or somewhere, and paste the links here)? Ideally also a mockup of what you are trying to do.
snibgo's IM pages: im.snibgo.com
christiaan
Posts: 13
Joined: 2013-08-09T01:20:06-07:00
Authentication code: 6789

Re: Wood tiles overlay with multiply, offset & density

Post by christiaan »

I just posted the input files above in the original post. The wood image should be exactly on the white lines on source.jpg.
I think I can handle the DPI problem by myself right now, but I don't think "composite" is the right command for my use.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Wood tiles overlay with multiply, offset & density

Post by fmw42 »

try this. you can adjust the size and offsets as needed. I tried to measure the inside of the pink border, but am not sure if it was perfectly accurate.

Code: Select all

convert source.jpg \( -size 2863x2122 tile:wood-px.jpg \) -geometry +13+16 -compose multiply -composite result.jpg
christiaan
Posts: 13
Joined: 2013-08-09T01:20:06-07:00
Authentication code: 6789

Re: Wood tiles overlay with multiply, offset & density

Post by christiaan »

Thanks fmw42! That seems to do the trick. Is it also possible to get the width & height of the loaded image source.jpg, instead of manually entering pixel sizes?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Wood tiles overlay with multiply, offset & density

Post by fmw42 »

Code: Select all

xoff=13
yoff=16
xsize=`convert source.jpg -format "%[fx:w-2*$xoff]" info:`
ysize=`convert source.jpg -format "%[fx:h-2*$yoff]" info:`
convert source.jpg \( -size ${xsize}x${ysize} tile:wood-px.jpg \) -geometry +${xoff}+${yoff} -compose multiply -composite result.jpg
Post Reply