How to use image coordinates from photoshop in imagemagick - imagemagick

I am trying to distort image to make it look as much realistic on the T-Shirt as it can. I can make it in photoshop look amazing, but I am having problem in actually transforming it using imagemagick into actual code and than making it look same as it looks on photoshop on my website.
We are adding images on T-shirts mockup through Admin panel where distortion for final customer or viewer of the website takes the most important part of our product as it is an ecommerce site.
I am attaching two photos to show you the actual problem, these are the photos from Adobe Photoshop, and I am looking for help to let me know if anyone had experience with this how I can take this exact code from image distortion from photoshop and use it for imagemagick metods to actually make it the same on my website.
Here is some of the code we are using:
$process55 = new Process('convert '.$path.'/image/ms_displaced_logo.png -matte -virtual-pixel transparent -distort Perspective "0,0,0,0 0,1342,0,1300 1899,0,1700,0 1899,1342,1850,1300" '.$path.'/image/ms_displaced_logo_distort.png');
$process55->run();
if (!$process5->isSuccessful()) {
throw new ProcessFailedException($process55);
}
echo $process55->getOutput();
echo '<img src="\image\ms_displaced_logo_distort.png">';
Thanks for help!

Related

How to use G'MIC/ImageMagick to restore the text quality in an image?

I would like to convert images of blurred text, like this:
Into a quality similar to this, with sharp edges and not "pixilated":
Background: I'm currently working on pipelines to upgrade the video qualities of recorded classes. I intend to do that frame by frame. So far, I need a command to transform this category of images (mainly with text) into better-quality ones.
My problem is, I don't know and I didn't find any specific filters that could be helpful.

How does gravatar adjust the colour in your images automatically?

I decided I wanted to change my gravatar to be circular. I have it circular on my blog with css and prefer the effect so decided to use a bit of imagemagick to give my image a circular alpha channel (so I could have it on SO, e.t.c. as well). a couple of quick commands later I was sorted:
# crop to square 422x422 with 0x0 offset
convert mike_gravatar.jpeg -crop 422x422+0+0 mike_gravatar_square.jpeg
# give circular alpha channel around it NOTE this is for a 422x422 image (note the 211x211)
convert mike_gravatar_square.jpeg \( +clone -threshold -1 -negate -fill white -draw "circle 211,211,211,0" \) -alpha off -compose copy_opacity -composite mike_gravatar_circle.png
brilliant, now we just upload this to gravatar, I will have a nice circular cropped image and all will be well with the world.
as you have probably guessed from the question all is not well:
ok, I must have clearly messed up my imagemagick and not checked that the before and after image are the same, reopen the images next to one another, and see that they are indeed the same. I try uploading again to gravatar and notice that they seem to process the images after the "cropping" stage, here is what it looks like in the browser after the file upload (before the cropping messes it up):
Alright, lets do some digging, someone else must have stumbled upon this before, so I have a look around and one lone soul in a desolate forum wasteland cries out. Now there is no response to this, but the relevant text is here:
It seems that if a photo or picture uploaded to Gravatar's cropper
doesn't have jet black, it will auto-level the nearest grey to black
and darken the whole image, including darkening whites into greys. Can
confirm that this occurs with any PNG image that has a grey background
or has a large enough proportion of it, whether or not it has 255
whites and regardless if it has alpha-blending or not
So it seems like I can fix this by putting in a single black pixel, that sounds alright so I try adding a black pixel, then a single black and a single white pixel, result:
So basically now I'm out of ideas:
does anyone have any idea what post-processing gravatar does, so I can undo it or counteract it's effects with pre-processing?
is this "feature" documented anywhere, or can it be turned off, or gotten around?
I think it would be quite cool to preprocess the image to counteract the darkening they would do to it but that would require knowing exactly what they do in order to change things and obviously might not be possible (depends on the relative movement of each colour, I suppose)
EDIT:
I tried making an inverse image to see if it was basing the processing on the average or the extreme values and that was also darkened, it seems that it's more likely to be the average:
Alright, I've got a solution that "worked for me" unfortunately it is just empirical and "good enough" (I'd quite like to check what's actually happening but unfortunately don't have any more time to devote to being nerd sniped) I'm gonna post what I did, what I think might have happened and how I think this should be solved if someone has enough time.
First off what I did, I simply tried whitening the image by random amounts, what ended up working was a gamma around 2
convert mike_gravatar_circle.png -gamma 2 mike_gravatar_circle_light_2.png
here is what the picture looks like both before and after processing by gravatar:
I feel it's pretty ridiculous that I need to clobber my picture like I do on the left to make it look normal so I'm going to leave this question open to see if anyone can show me a better/cleaner way of doing this.
EDIT: forgot to mention my (completely unfounded) guesses as to how this should be solved. So my guess is that gravatar might try and make the average color of the image some type of midrange value (as that might seem sensible... I guess, I don't know) and picks up the alpha as being all white. trying some experiments to determine could be interesting, but only if they had an api to automate uploading and downloading the images or it would be painful effort, I'm looking forward to any suggestions as to what people think is happening.

Titanium Image Processing

I am currently working on Appcelerator (Titanium) and now I want colorize image in APP. Like I have an image and I can able to change its color through Hue or saturation just like in Photoshop. I have searched too many things but still nothing found in working condition.
Any help would be highly appreciable
Probably the best architecture is to create a webview in which you have a canvas tag, then you are able to use any canvas image manipulation library you wish. There are a number of them, but here are a few.

How to remove background of a low contrast image using imagemagick

I am new to Imagemagick and am trying to work out a script which I can use to remove the background of a number of images.
The problems is that some images (see sample below) involve objects whose main color is very close to the background.
Can someone help me pointing the right approach and/or providing real-life examples with which I can play?
Thanks a lot!
!(http://dev.gmce.com.br/foto2-small.png)
convert test.jpeg -white-threshold 90% -transparent white output.png
just play with the threshold percentage

ImageMagick - Transparent background - Act like Photoshop's "Magic wand"

I'm trying to convert hundreds of images that
Have an unknown subject centered in the image
Have a white background
I've used ImageMagick's convert utility in the following way
convert ORIGINAL.jpg -fuzz 2% -matte -transparent "#FFFFFF" TRANSPARENT.png
The problem is, some of my subjects are within the "white" scale, so, just like the weatherman wearing a green tie, some of my subjects seem to be disitegrating.
Is there any way to solve this via ImageMagick? Are there any alternative solutions? Scripting GIMP?
As you said, GIMP has a magic wand tool that can be used to select continuous areas of the same color, and so it can avoid the "green tie syndrome". The problem is that it may introduce a problem if there is something like a human hair crossing the image (that will seperate some of the white areas). Another common problem, especially with pictures of people, is when they put their hand next to the body and between the hand and the body there is a small hole.
Basically, it is not too hard to create a GIMP script that opens in batch many images, uses the magic wand to select the pixel at some corner (or if desired, in several known fixed places, not just one) and then removes the selection.
If it's hard to find a white area at a fixed spot, it is possible to do a search inside - meaning that the script searches for a white pixel on the borders, and it goes inside gradually in a spiral untill it finds some white pixel. But this is very very unefficient in the basic scripting engine, so I hope you don't need this.
If any of the suggested options above is OK, tell me and I'll create a gimp script for it. It will be even better if you can post some samples images, but I'll try to help even without these.

Resources