Re: Is it possible to calculate width and paste min/max images in a row/column?
Posted: 2019-05-10T04:52:42-07:00
Correct, the blank card is created first, with the same code though, just with the amount of stamps a store owner would like to use (sets a number from a pull down).snibgo wrote: ↑2019-05-10T04:22:54-07:00 loyalty-card-botox_9991001.jpg is the image of lips, with white circles as placeholders for the stamps, correct? Then the heart-stamps should be placed on the placeholders. I can't find where you have posted loyalty-card-botox_9991001.jpg, or code that makes it. That means I can't test your code, or my code.
You are making an image of 4 heart stamps, and resizing that to width 480. I can't see why. If you have 5x3 circle placeholders, then resizing to four-fifths of something seems more logical.
I think the fundamental problem is that you are creating the circle placeholders with some code, then resizing and creating the heart stamps with some different code, and trying to get them to match.
It seems cleaner to create 15 objects. 4 of those have hearts over circles, and the rest are circles only. Then montage those 15 objects and composite the result over the main mage. Windows BAT script:Code: Select all
%IMG7%magick ^ stamp_circ.png stamp_heart.png ^ -compose Over -composite ^ -duplicate 3 ^ ( stamp_circ.png -duplicate 10 ) ^ miff:- | %IMG7%magick montage - ^ -bordercolor None -border 2 -tile 5x3 -background None -geometry +10+15 ^ miff:- | %IMG7%magick ^ loyalty-card-lips-backup.jpg ^ -set option:NEWWIDTH "%%[fx:w*0.8]" ^ ( - -resize %%[NEWWIDTH]x ^ ) ^ -gravity South ^ -compose Over -composite ^ stamp_out.png
Of course this
is the ideal situation, I could get that working due to lack of skillz;-).It seems cleaner to create 15 objects. 4 of those have hearts over circles, and the rest are circles only. Then montage those 15 objects and composite the result over the main mage
I had the stamp with background circle at first, but i got empty space in stead of empty circles.
Would your code also work when somebody fills in 6 stamps slots, or 12, 18, 24 etc? Is it flexible in filling up the lower half of the image?
Thanks for taking time to dig in. You rock!