layered png image using a PHP library - php

Does anyone know about a PHP library which can produce layered PNG images? (I'm not sure, but I think that tiff image standard supports layers also)

AFAIR, PNG does not support layers. MNG does and you can produce these with ImageMagick. For PHP extension see: http://www.php.net/imagick

From the ImageMagic API site:
PHP
MagickWand for PHP a native PHP-extension to the ImageMagick MagickWand API.
IMagick is a native PHP extension to create and modify images using the ImageMagick API. Documentation for the extension is available here.
phMagick is a wrapper class for ImageMagick, wrapping the most common web image manipulation actions in easy to use functions, but allowing full access to ImageMagick's power by issuing system calls to it's command-line programs.
ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.

Assuming you mean the layered PNG files as per fireworks, I don't think you can do it. I've not seen anything except fireworks that supports these files properly.

Related

Can we apply Instagram effects on a video using PHP?

As we all know, it is possible to add/edit effect on a image using php. But can we also do the same thing for a video? I have done some searching for this but no results.
I am giving a link which shows how to show effects on an image and which is working fine, but what about video?
You can do this image effects with GD library.
PHP is not limited to creating just HTML output. It can also be used
to create and manipulate image files in a variety of different image
formats, including GIF, PNG, JPEG, WBMP, and XPM. Even more
convenient, PHP can output image streams directly to a browser. You
will need to compile PHP with the GD library of image functions for
this to work. GD and PHP may also require other libraries, depending
on which image formats you want to work with.
But unfortunately there is no library available in php to Video accessing and adding effects.

Converting a TIFF image to PNG/JPG/GIF in PHP without Imagick

I am working on a website for my client in which tiff images need to converted to png or jpg before they are assembled into a PDF.
I have read many articles, here and other sites, on this issue. They all recommend using Imagick to accomplish this. The problem is, my client's server does not have that extension installed, and the hosting company is unwilling to install the extension.
Nor is PDFLib installed on the server (which supports importing tiffs into a PDF).
Thanks.
This is tricky because of the tiff format. You can do this for most input formats with native PHP functions to create an image object from the source file and then save that using imagejpeg or imagepng. But tiff has patent issues and I don't think it's supported. Have a look at the PHP GD and image functions available on your server. May be some help in the comments here: http://php.net/manual/en/function.pdf-open-image-file.php

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.

What PHP compression utility and settings will mimic Photoshop's "Save for Web"?

I've tried about a half dozen compression utilities and have been unable to get anywhere near the compression level that Photoshop's "Save for Web" feature gets (5-10x smaller). I think the problem is that most of the utilities can't change bit depth of the image as part of the compression process.
I'd like to use a PHP compression utility (if possible).
My settings on Photoshop's "Save for Web" are:
png-8
selective
diffusion
no transparency
64 colors
100% dither
If it's a dramatic difference in size, then you are probably right and it's not reducing the bit-depth. ImageMagick is going to give you a good amount of control. The other thing that PS "save for web" does is strip most of the meta-data, but that savings is usually pretty minimal.
Using ImageMagick you can use the format png8:filename.png for 8-bit pngs, you'll have to look at the documentation to get the rest of the attribute settings, but note that for PNGs, the quality setting is not the same as lossy formats like jpg, each digit represents a different png setting.
To use, install the ImageMagick library and either run the commands via one of the PHP exec functions or install the PHP PECL extension, imagick.
Imagemagick is a nice PHP image utility and is used by most developers for advanced Image algorithms. I would recommend looking into this utility for further image manipulation needs. Specifically Imagick::setCompressionQuality
PHP Imagemagick
convert -thumbnail -quality '70%' from_path to_path
convert - console variant of ImageMagick...
just play with settings...

PHP or CGI - Convert .ico to gif or png or jpg?

How do you convert a favicon.ico to a regular web-accessible graphics - gif, png, or jpg using PHP or C/C++/CGI?
Are there methods that do not require ImageMagick?
You cold use imagemagick. Eigther you use the native php extension or you use a php exec command (for a commandline command) and then get the transformed image or as last option you use imagemagick as a server and request the new image from a webadress.
There are other commandline tools available, but they are not as powerfull and easy to use as imagemagick (i.e. GD);
If your server doesn't have Imagick installed, you can use GD (the hard way). You can do a pixel-by-pixel mapping by using the following format for sniffing the actual bitmap: http://www.daubnet.com/en/file-format-ico
Use ImageMagick or one of its bindings.
Netpbm can handle all those formats and doesn't get nearly as much attention as it deserves.

Categories