PDP GD Skewing images - php

Is it possible with PHP GD to skew/distort images on both sides ?
I already check other question/solution but I really don't understand how to move all the corners of the image.
What I need is transform a flat image to a distort image moving all 4 corners, something like if you use Adobe Photoshop transform distortion function that allows to move single corner to a new position.
Is it possible ?
Many thanks in advance.
Bye

It can be done with the help of the QB extension.
In theory, it's possible to accomplish the same thing using just the built-in GD functions. It'd be agonizingly slow though.

Related

Place the top left corner of an image on a specific pixel with imagemagick

I have an image of NxN size and an image of MxM, with N>M. I want to place the second on top of the first, but I want to do it on a specific pixel e.g.(10,15)
I installed imagemagick and start playing with it cli (planning to try with php later), but I could not find if there is something that I could use for this purpose or if it is possible by combining some commands.
So my question(s):
Is something like this possible with imagemagick?
If yes, how could I achieve it in command line imagemagick?
If yes, how could I achieve it with imagemagick in php?
Expanding on my comment, I think php gd would be a good fit for this. PHP gd is better integrated into php and works better in my opinion. I use it for a host of things (resizing thumbnails most notably). Your question seems very similar to placing a watermark on an image, ie one image is place on top of another and it is exported as a single raster image. Here's a quick example for creating this watermark:
http://www.sitepoint.com/watermark-images-php/
This example exports it directly to the browser, but it can be easily modified to save the image locally to your file system. Enjoy!

php, gd, color switching with antialiasing and shadows

I want to make a wordpress theme with a color picker to switch the main color(s) of the theme.
At some points of the theme the colors I want to change could be in images - maybe when it comes to rounded corners, overlapping stuff or anything else that couldn't be easily done in plain CSS.
I planned to take care of those things using a color switching function in GD. However, as I have basically no experience with GD I first wanted to make sure if those color switching functions can take care of shadows, antialiasing and stuff like that. The examples I found yet all just changed one plain color to another plain color.
Is there a trick to do that with GD and if yes, can you give me a link to a tutorial or a good example?
Thank you!
It'd be better to replace all those fixed-color-antialias images with .png images with appropriate transparency set on any bits that need to be merged with the background. That way you only have one set of images for the theme, instead of one-set-per-color-scheme, which could quickly get unmanageable.
Plenty of colorize algorithms:
http://php.net/manual/en/function.imagefilter.php
You should also find something nice in google searching for "php colorize"

PHP GD library losing quality. Other ideas?

So I'm in the middle of working on a website that deals with photographs. A user uploads their original photograph and GD library creates a smaller sized image of the same photo. However, when comparing a manually sized down image with the GD one, the GD image seems to lose quite a bit of color quality like it had been slightly desaturated. Any alternate suggestions or ways to improve this?
Thanks!
I'd advice using imagemagick for handling anything serious about photos.
besides quality, you'll find using imagick functions like more convenient
Imagick::cropThumbnailImage()
Imagick::thumbnailImage()
Use imagecopyresampled instead of imagecopyresized. It gives much better quality. Also, try NOT to use GIF images as output.
Wow, the answer is imagemagick. Easier to use and maintains the full photograph quality!

Merging (watermark) a jpg with png while resizing the png in PHP GD

I am sure I could somehow figure this out but it's just taking me way too long since I am not a PHP guy. Hopefully someone can set up the script for me in minutes...
So here's what I need to do:
I transmit 2 pictures from a smartphone to a webserver. These 2 images need to be merged (watermarked). They differ a little:
picture is a 2 megapixel jpg (holding a photo)
picture will be a png of 480x800 pixels with a transparent background (holding a simple finger painting)
Now I need to merge these images. The 2nd one (png) needs to be scaled to the 1st one's (jpeg) resolution.
Please note 2 things:
I can only use the GD library that is installed on the server. Imagick or alike is not available
I am well aware of the fact that the 2nd image's quality won't be brilliant. That's okay.
So could anyone help me out on this? Like I said, I've been messing around with a couple of GD functions but progress is far too slow. I guess I found the required functions with imagecopy and watermark. But I don't find the right way to put 'em together.
Thanks in advance,
steff
Thanks a million
A few months ago i posted a function that does that, since the code is quite big i will just link my post, check it out here. Make sure you don't do this onfly, it will overload your server, save the watermarked images or at least cache them.
If you also need to resize the original or watermark, i also posted a function to do this here.

How can I produce a small stamp on each image on my site

i work in lamp environment .
i search script that know to take a image , that user upload to my site.
and make from this image , new image that contain the real image with small stamp on the top corner.
thanks
your best bet would be to look here it is an ideal script provided by the PHP.net user guide. Just make sure that you have the GD library installed
You'd want a watermark which can be accomplished with GD
What you are describing is "watermarking". There are tools out there to do this, a lot of image manipulation packages have this feature.
A search for this might lead you to something useful.
Have a look at these PHP tutorials:
Using imagecopymerge() to create a translucent watermark
Adding watermarks to images using alpha channels

Categories