TIFF image Rotation Using PHP - php

My Problem is:
I want to upload the tiff image and then i want to rotate that image automatically such that it is oriented correctly . And then user can download that correctly oriented tiff image.
I want to use PHP.
Thanks.

Without lib i don't think it's possible because tiff is an adobe format.
I think you should use command line of gimp with parameters or with another program like photoshop and save your image after oriented.
With php and exec function i think perhaps it's possible.

Related

How to connect ghostscript with imagecreatefrompng in PHP?

I am currently using ghostscript, via exec() from PHP, to create a PNG image that is saved to a file.
And then I use imagecreatefrompng() to load it into PHP. I am wondering if there is a way to directly connect these without first saving it to a file and then reading it from a file. Does this work with the expect:// wrappers? If so could somebody provide an example? I am not sure about the syntax.
Another solution may perhaps be with imagecreatefromstring() if one can get the image file as a string from ghostscript. I am looking for an example of how to do this. The image files I create are not that large, typically 600 x 150 pixels.

convert svg to cmyk using php or any command or using tcpdf

I am inserting svg image into pdf using tcpdf. And tcpdf writes pdf in rgb using this command
$pdf->ImageSVG
But i want to convert it to cmyk. So i thought i have 2 way to do this,
1)convert svg to cmyk
For this i tried this command
shell_exec("convert {$svgPath} -profile 'Canon_iPF_5000_-_iPF_8000_-_iPF_9000.icc' {$svgoppath}");
But not working
2)convert pdf to cmyk while writing svg
I tried to find in google regarding this, but no proper documentation of tcpdf to force write pdf in cmyk
Is there any better way to achieve this?
The PHP way to convert to colorspace is to use iMagick's setimagecolorspace which is the equivalent to the exec(convert..... If option 1) doesn't work, chances are setimagecolorspace will fail too.
Ensure that imagemagick library & utilities are installed on server, else you'd be spending hours debugging code that isn't broken.

How can i convert a svg image to png image with Imagemagick when the svg file has embedded images?

With PHP i'm creating an image with embedded content (base64 encoded files). If i see it using Firefox, or downloading it and then opening it with Inkscape (www.inkscape.org), the image is fine!.
But when i try to convert it using imagemagick (using convert command or with Imagick support for PHP) the embedded image doesn't come in with the final result.
I don't know if there is a special command or configuration i'm missing. I'm not using any special setup. Just ...
convert image.svg image.png
Thank you very much for your answer.
ImageMagick's built-in SVG rendering is really pretty horrible. Don't use it if you can avoid it. I'd recommend using librsvg instead, either using the command-line rsvg tool, or possibly with the PHP rsvg extension.
(Librsvg's rendering isn't always perfect either, but it should be able to handle embedded images just fine. If you want even better rendering, you could always try using Inkscape from the command line.)
Is the embedded image in PNG or in Jpeg format? What converter is used in PHP? I tried on Windows with latest ImageMagick, which doesn't come with RSVG. I found a RSVG-Converter build for Windows, and, while it does a good job, it skips the Jpeg version of the image of a test file.
On the other hand, the built-in converter handles correctly both images, but does an awful job on the home image shown in the SVG tutorial.

layered PSD or TIFF creation from webpage (either PHP or JS)

Does anybody know which programming library I should use to throw a transparent PNG on top of a JPG and export a layered file for photoshop ? like a TIF or PSD or anything that can be loaded in photoshop.
I know the GD library can be used to output to screen or a non-layered file, but I'm wondering is there any format I can output to with proper intact layers...
Preferably something clientside with JS but I can do PHP serverside if that's my only option. I've done a bit of googling on the subject, hard to format the search really.
Any ideas would be really appreciated.
Thanks !
I think you will need a server side solution using PHP and ImageMagick to create layered tiff files.
Also check out the examples of layers using ImageMagick
Then you can use setImageFormat("tiff") to save the final file as a layered tiff file.
I hope that helps.

Convert PDF to images in php

These are the steps I am trying to achieve:
1) Upload a PDF document on the server.
2) Convert the PDF document to a set of images, and saving them.
Any ideas for doing #2 using php??
If you have the ImageMagick extension compiled into PHP, it should be able to read in PDFs and convert them to any common image format. I don't believe the GD extension (which is more common) has PDF capabilities, sadly.

Categories