Cut a Tshirt out of pattern image
Cut a Tshirt out of pattern image
Everyone,
Could you please guide me on what the commands would be to do a cut of an image. Im new to ImageMagic and did not see anything that was exactly (only partially) to handle my issue.
We get already presized image files to go on a mens or womens tshirt (soon dress). To save spraying all the ink we would like to cut the image to predefined coordinates for each size, and type.
How do I first determine (given a template files) all the coordinates and create commands for each size and style.
how do i convert the template into coordinate numbers?
Will this work in .NET?
I can understand php, c++ if need be.
Here is a link to an example of what needs to be done. http://www.relationship1.com/help.zip
Inside help.zip is
STYLE1__XS_TEMPLATE_FILE_PDF.pdf – outline of what needs to be CROPPED out for this size and style
STYLE1_XS_asset_before.png – this is the image before
STYLE1_XS_TEMPLATE_FILE_PHOTOSHOP_METHOD.ODS – this is some photoshop file they use to do this manually with (there is some hidden layer in here)
STYLE1_XS_TFILE_PDF_WITH_IMAGE_AND_TEMPLATE.pdf – this is what the step would look like right before its completed
STYLE1_XS_TT_asset_completed.png – this is the desired input
[1]: http://www.relationship1.com/help.zip
Could you please guide me on what the commands would be to do a cut of an image. Im new to ImageMagic and did not see anything that was exactly (only partially) to handle my issue.
We get already presized image files to go on a mens or womens tshirt (soon dress). To save spraying all the ink we would like to cut the image to predefined coordinates for each size, and type.
How do I first determine (given a template files) all the coordinates and create commands for each size and style.
how do i convert the template into coordinate numbers?
Will this work in .NET?
I can understand php, c++ if need be.
Here is a link to an example of what needs to be done. http://www.relationship1.com/help.zip
Inside help.zip is
STYLE1__XS_TEMPLATE_FILE_PDF.pdf – outline of what needs to be CROPPED out for this size and style
STYLE1_XS_asset_before.png – this is the image before
STYLE1_XS_TEMPLATE_FILE_PHOTOSHOP_METHOD.ODS – this is some photoshop file they use to do this manually with (there is some hidden layer in here)
STYLE1_XS_TFILE_PDF_WITH_IMAGE_AND_TEMPLATE.pdf – this is what the step would look like right before its completed
STYLE1_XS_TT_asset_completed.png – this is the desired input
[1]: http://www.relationship1.com/help.zip
Last edited by mcbain942 on 2016-05-26T13:31:24-07:00, edited 1 time in total.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Cut a Tshirt out of pattern image
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Cut a Tshirt out of pattern image
Also provide your IM version and platform (presumably Window if you want the result as Magick.NET)
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Cut a Tshirt out of pattern image
This works for me on IM 6.9.4.4 Q16 Mac OSX. You can do this in PHP exec(). Or you would need to repost this to the Magick.NET forum for a solution using that API.
For IM 7, replace convert with magick.
Sorry, I do not understand the issue with coordinates. You have not specified and dimensions or coordinates other than the size of the colored image. The PDF is vector format, so it has no size, but can be scaled to any size. So I scaled the PDF to the size of the colored image in its maximum aspect dimension and centered the result so that it would crop out the colored image to its largest dimension.
The 2 pixel border that was added was to ensure that the floodfill can go all around the outside of your outline. The extra border is then shaved off afterwards.
Code: Select all
dim=`convert STYLE1_XS_asset_before.png -format "%wx%h" info:`
echo "dim=$dim"
convert STYLE1_XS_asset_before.png \
\( -density 288 -colorspace sRGB STYLE1__XS_TEMPLATE_FILE_PDF.pdf -alpha off \
-resize $dim \
-background white -gravity center -extent $dim \
-bordercolor white -border 2 \
-fill black -draw "color 0,0 floodfill" \
-shave 2x2 \) \
-alpha off -compose copy_opacity -composite \
result.png
Sorry, I do not understand the issue with coordinates. You have not specified and dimensions or coordinates other than the size of the colored image. The PDF is vector format, so it has no size, but can be scaled to any size. So I scaled the PDF to the size of the colored image in its maximum aspect dimension and centered the result so that it would crop out the colored image to its largest dimension.
The 2 pixel border that was added was to ensure that the floodfill can go all around the outside of your outline. The extra border is then shaved off afterwards.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Cut a Tshirt out of pattern image
This was moved from the Developers forum to the Users forum
Re: Cut a Tshirt out of pattern image
fmw42:
really you do not need the pdf's at all.
The input is the png. The output descired is the result(varied by some sort of image file or layer). I can get the template in a png format instead. can you send back your output while in try to convert to ImageMagick.NET
really you do not need the pdf's at all.
The input is the png. The output descired is the result(varied by some sort of image file or layer). I can get the template in a png format instead. can you send back your output while in try to convert to ImageMagick.NET
Re: Cut a Tshirt out of pattern image
this is basically what i want to do , but with a tshirt
viewtopic.php?t=21391
Ignore that the template file is a pdf, i have asked the client to send read png files with the correct size.
viewtopic.php?t=21391
Ignore that the template file is a pdf, i have asked the client to send read png files with the correct size.
Re: Cut a Tshirt out of pattern image
please delete post double
Re: Cut a Tshirt out of pattern image
the following is the answer
Code: Select all
the following is the answer
static void Main(string[] args)
{
using (MagickImage mask = new MagickImage(@"c:\help\maskO2_XS.png"))//black where the cut would be white where the asset is
using (MagickImage image = new MagickImage(@"c:\help\STYLE1_XS_asset_before.png"))//pattern file
{
mask.Resize(image.Width, image.Height);
image.Composite(mask, CompositeOperator.Bumpmap);
image.Write(@"c:\help\file_out.png");
}
}