Unsharp mask with php - php

Is there a built-in function in php to add some extra sharpness on images? Like Photoshops unsharp mask?

Yes, the easiest way is to use the phpThumb library. Here is a demo of the sharpen feature:
http://phpthumb.sourceforge.net/demo/demo/phpThumb.demo.demo.php#x14
You can apparently also use imageconvolution() in the GD library (phpThumb uses either GD or ImageMagick, whichever is available):
http://www.php.net/manual/en/function.imageconvolution.php

Related

how to use imagettfbox() in Imagick?

I was family with GD of any image processing. But I just change to use Imagick because it's faster than GD. But I don't know how to use imagettfbox (GD) to Imagick.
Please help me with example or method of it ^_^
Adding as an answer from the comment above:
This appears to return the bounding box of a character: http://www.php.net/manual/en/imagick.queryfontmetrics.php

PHP gd imagettftext() height

Is there a way to get PHP imagettftext() font height?
I know that we can get width by imagettfbbox(). Can we get the height too?
Yes, you evidently can simply be looking at the documentation. Scroll down and use your browsers find function to search for the following:
jodybrabec at gmail dot com
Below his name he provides a nice cusotm function for you to use.
(got a link actually right here, no need to use the find function: http://php.net/manual/en/function.imagettfbbox.php#105593)

Auto New Line In GD Library

I'm using the GD Library to create images from data I'm pulling from an API.
The strings that are returned can sometimes be kind of lengthy, and I'm hoping to find a way to automatically create a new line for text if the string goes too far.
Is there something like this built into the GD library, or will I have to write some code to count the characters and move everything to a new line if it goes too long?
GD is strictly for drawing. You'll need a text layout engine such as Pango.
I am not familier with a built-in function that automatically creates new lines,
so I guess you need to write a php function that sorts the string to "sub-strings"
according to your width length and then use them in your image.
Consider looking at this post:
http://www.php.net/manual/en/function.imagestring.php#90481

Video thumbnail generation imagemagick?

I have been searching for an alternative to ffmpeg (I'm on a host that doesn't allow ffmpeg or mencode due to server power or something) and I was looking into GD or Imagemagick (both of which are installed) is there a way to generate a video thumbnail from either of these two libraries or another one?
I also have the option of using ruby on rails or python or CGI/perl to do the generation. But I'm not skilled in either of those languages so I would need a tutorial or script already wrote.
Anyone help?
Imagemagicks Convert can do video tumbnails.
convert -quiet moviefile.mov[10] movieframe.gif
where the number between the [] is the framenumber of the movie that is converted
In fact, ImageMagick just uses ffmeg under the hood. If ffmpeg is not installed, you'll have no luck using ImageMagick
As tijej said you must need ffmpeg in order to use ImageMagick. If you are OK with that you can also use FFmpeg::Thumbnail module.
Sample:
my $baz = FFmpeg::Thumbnail->new( { video => '/my/video/file.flv' } );
$baz->output_width( 640 );
$baz->output_height( 480 );
$baz->offset( 21 );
$baz->create_thumbnail( undef, '/my/first/thumbnail.png');

Measuring a string in PHP?

ASP has a MeasureString function that returns the width, in pixels, of a string given a certain font/size. Is this possible in PHP?
Yes, using GD library.
http://www.php.net/manual/en/function.imagettfbbox.php
this is for text rendered on an image.
Text width varies a bit depending on the browser, OS (font smoothing, different rendering)
Perhaps you could use the imagettfbbox function if you have GD installed

Categories