0

Very new to graphicsmagick but I can see that it is very powerful. I have a decal site and I am looking to update my images. I do this in my spare time so I don't really have budget for anything so I try and do all work I can myself.

All of the 'patterns' I use are in EPS vector format. They are all monochrome. I send this EPS pattern to my vinyl plotter and it cuts the shapes out on whatever colored vinyl I have loaded.

For the website images what I would ultimately like to do is take an image of the back glass of a truck, and overlay the EPS in one of the colors I sell with a transparent background. This would give my customers an idea of how the decal would look on their vehicle.

Is it possible to use graphicsmagick to generate different versions of each EPS in different colors or will I have to create a version of the EPS for each color?

Does anyone know of any good examples for doing any of this? I've succesfully resized and merged an EPS with another image, but I'm a bit lost when it comes to adding transparency. Do I need to select a color? If so, do I choose white as that's the background color of the resulting jpg? The EPS files don't have a background color as far as I know.

Any help is most appreciated.

dinki
  • 103
  • 7

1 Answers1

2

Assuming your EPS represents a black decal on white, you can use "-transparent white" to make the white part (the vinyl scrap) transparent, and "-fill #FF0000 -opaque black" to make the rest of it the color of your vinyl (in this example, red, which is hex #FF0000), and write the result as a PNG with transparency:

gm convert decal.eps -transparent white -fill "#FF0000" \
           -opaque black -matte decal_red.png

Then rescale decal.png and overlay it on your truck image as you have already done:

gm convert truck.jpg -draw "image over x,y 0,0 decal_red.png" \
           truck_with_red_decal.jpg

where you replace x and y with the coordinates of where you want to place the upper left corner of the decal on the truck image. "0,0" are the width and height of the overlay image (if 0 they default to the dimensions from the image file)

Glenn Randers-Pehrson
  • 11,940
  • 3
  • 37
  • 61
  • Thank you for this information. I've managed to use the first command to successfully change colors. I've tried the second but unfortunately I'm getting an error: $ gm convert truckwindow.jpg -draw "image over x,y 0,0 decal_red.png" truck_with_red_decal.jpg gm convert: Non-conforming drawing primitive definition (image). Can you tell me what might be going wrong? – dinki Aug 04 '14 at 15:05
  • Thank you for this information. I've managed to use the first command to successfully change colors.

    I've tried the second but unfortunately I'm getting an error:
    $ gm convert truckwindow.jpg -draw "image over x,y 0,0
    decal_red.png" truck_with_red_decal.jpg gm convert: Non-conforming drawing primitive definition (image).
    Can you tell me what might be going wrong? *EDIT* As you can see I'm having trouble formatting my reply. I hope you can see what I'm trying to say.
    – dinki Aug 04 '14 at 15:10
  • Me again. I figured out how to do it using composite: gm composite -geometry +100+100 decal_red.png truckwindow.jpg truck_with_red_decal.jpg This is absolutely perfect. I'll write a little script to generate each image and let it crunch. You're the best! – dinki Aug 04 '14 at 15:26
  • Did you replace "x,y" with actual numbers like 100,100 ? If you left them as literally "x,y" you'd get the "non-conforming" error. – Glenn Randers-Pehrson Aug 04 '14 at 16:41
  • I did not. I thought that the 0,0 was the positional information. What is 0,0? Also, the first step is not working for all files. I am not able to convert the color from black to white. I'm able to convert white to transparent, but I am not able to convert the black areas to white or any other color. Any idea on what might be happening? I can provide a sample file if that would help. Many many thanks! Here's a sample of what I'm trying: gm convert $file -density 288 -size 175x175 -transparent white -fill "#FFFFFE" -opaque white -matte -resize 175x175 tmp.png – dinki Aug 04 '14 at 17:56
  • A sample decal.eps would be helpful. – Glenn Randers-Pehrson Aug 04 '14 at 19:46
  • Here's one of the files that does not change to white https://www.dropbox.com/s/xbdaq5qcixw2k7e/d3223-CLIPART.EPS .. I have others that do turn white though. I'm hoping it's something simple. Thank you again. – dinki Aug 04 '14 at 20:38
  • d332*.EPS is antialiased and has many levels of gray, but no black. You can use "-threshold 128" to convert it to black-and-white, and then proceed as before. – Glenn Randers-Pehrson Aug 04 '14 at 23:29
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58649/discussion-between-dinki-and-glenn-randers-pehrson). – dinki Aug 05 '14 at 00:02