IT Community - Software Programming, Web Development and Technical Support

Image handling in php

This is a discussion on Image handling in php within the PHP Programming forums, part of the Web Development category; Hi Friends, As in my previous discussion about image effect and artism there is few really important command available in ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #41 (permalink)  
Old 09-04-2007, 06:45 AM
venkat_charya venkat_charya is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 118
venkat_charya is on a distinguished road
Thumbs up Re: Image handling in php

Hi Friends,

As in my previous discussion about image effect and artism there is few really important command available in Magick functionality.

Colorizing is the process of blending the color of each pixel with a specified color. The argument to the effect is the color to blend with. This can either be specified as a percentage (which will be used for each of red, green, and blue) or as three percentages. It is also possible to provide either one of three actual values.
convert -colorize 255 input.jpg output.jpg

The implode effect simulates the center of your image being sucked into a virtual black hole. The argument is the amount of implosion effect you desire.
convert -implode 4 input.jpg output.jpg

These two image manipulation command will generally used for negative image creation and scenaric presentation.

Thanks
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #42 (permalink)  
Old 09-04-2007, 06:55 AM
venkat_charya venkat_charya is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 118
venkat_charya is on a distinguished road
Thumbs up Re: Image handling in php

We can use some kind of negative effect too in images with some command line argument. Like solarize.

Solarizing is an effect that occurs when a negative is exposed to light part way through the photographic development process. Here, the input argument is the intensity above which to apply the effect, either specified as an absolute value, or as a percentage of the maximum possible value for the pixel. If a pixel is above the threshold, then it is negated.

convert -solarize 10 source.jpg destination.jpg


Another command is Spread. Spread moves pixels by a random amount within the image. The argument is the size of the area around the pixel from which to select the new location. It therefore specifies how closely the output resembles the input:

convert -spread 3 source.jpg destination.jpg

We can use the multiple command in one statement. For example to use sample, spread and charcoal we ca use this statement.

convert -sample 25%x25% -spread 4 \ -charcoal 4 input.jpg output.jpg

we want to make a thumbnail of an image, and then apply a spread to it. Once the spread has occurred, we'll apply the charcoal effect.

Thanks
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #43 (permalink)  
Old 09-06-2007, 03:17 AM
varghese varghese is offline
D-Web Programmer
 
Join Date: Feb 2007
Posts: 93
varghese is on a distinguished road
Default Re: Image handling in php

hi any manual avilable for image magic library..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #44 (permalink)  
Old 09-06-2007, 08:29 AM
venkat_charya venkat_charya is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 118
venkat_charya is on a distinguished road
Thumbs up Re: Image handling in php

Hi Varghese,

Here is the link which give you most of the magick function information.

PHP: Imagick Image Library - Manual

It give you all the magick fore ground functions. Hope that help to you.

Thanks
__________________
K K Venkata Charya
Success is easy to get but difficult to retain
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #45 (permalink)  
Old 09-07-2007, 11:53 PM
venkat_charya venkat_charya is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 118
venkat_charya is on a distinguished road
Thumbs up Re: Image handling in php

Hi Friends,

Here we going to discuss about some of the Image Magick functions which is commonly used in fore ground. There is no command line functionality here.

We already discussed few functions in same thread like

Imagick_readimage(): To read any image

Imagick_writeimage(): To save any image

Imagick_sample(): To create a thumbnail of any image with specified size.

Imagick_setdpi(): To set the resolution of the image.

Imagick_convert: TO convert the image type like JPG to PNG etc.

Now here we going to discuss about create multiple image with same class object. In many place we like to use list of image without creating some many instance and want to use that some concept like stack.

Magick provide a option like push and pop.

To insert many images in one object we can use the method called


imagick_pushlist($vConstantHandler,$vDifferentHand ler);

Thanks
__________________
K K Venkata Charya
Success is easy to get but difficult to retain
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #46 (permalink)  
Old 09-08-2007, 02:33 AM
venkat_charya venkat_charya is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 118
venkat_charya is on a distinguished road
Thumbs up Re: Image handling in php

Hi,

To write a Text on any image there is some set of functions we need to use to implement on any image with text.

imagick_setfontface() - Set Font style
imagick_setfillcolor() - Set Font Color
imagick_setfontsize() - Set Font Size
imagick_drawannotation() - Set X and Y coordinate with desired text

Example is as follow:
Imagick_setfontface( $handle, "Palatino-Bold" )
Imagick_setfillcolor( $handle, "#990000" )
Imagick_setfontsize( $handle, 50 )
Imagick_drawannotation( $handle, 325, 100, "Example Text" )


Thanks
__________________
K K Venkata Charya
Success is easy to get but difficult to retain
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #47 (permalink)  
Old 09-10-2007, 02:09 AM
varghese varghese is offline
D-Web Programmer
 
Join Date: Feb 2007
Posts: 93
varghese is on a distinguished road
Thumbs up Re: Image handling in php

hi
I have a problem in image rotation. I have one orginial image like
. Now i did small modification and rotated this to
240 degree and saved this with new image name like . I have no problem till this but once i try to rotate 120 degree more on already rotated image i got a problem in image size.

Original image area reduced and it contained more white area in new created image.

This problem didn't occur while i rotate 90,180,270,360. Otherthan that value it affect the image. So can anybody help to solve this issue.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #48 (permalink)  
Old 09-12-2007, 01:01 PM
Sabari Sabari is offline
D-Web Genius
 
Join Date: Jul 2007
Posts: 1,008
Sabari is on a distinguished road
Default Re: Image handling in php

How can we get the properties (size, type, width, height) of an image using php image functions?
__________________
Thanks & Regards
Sabari...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #49 (permalink)  
Old 09-12-2007, 01:07 PM
Sabari Sabari is offline
D-Web Genius
 
Join Date: Jul 2007
Posts: 1,008
Sabari is on a distinguished road
Default Re: Image handling in php

What Types Of Images That Php Supports?
__________________
Thanks & Regards
Sabari...
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #50 (permalink)  
Old 09-12-2007, 11:55 PM
Anand Anand is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 52
Anand is on a distinguished road
Default Re: Image handling in php

Varghese,

If you rotate an already rotated image then, it will rotate along with the white space only. Its not a bug. the functionality is like that. If you want to avoid this problem then you have to rotate the total angle from the original image (provided if you know the total angle to rotate from the original image.).
__________________
None of us is As Strong as All of us.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #51 (permalink)  
Old 09-13-2007, 01:10 AM
varghese varghese is offline
D-Web Programmer
 
Join Date: Feb 2007
Posts: 93
varghese is on a distinguished road
Default Re: Image handling in php

hi Sabari
use the function getimagesize(imagepath) -> Returns an array with 5 elements.

Index 0 and 1 contains respectively the width and the height of the image.

Note: Some formats may contain no image or may contain multiple images. In these cases, getimagesize() might not be able to properly determine the image size. getimagesize() will return zero for width and height in these cases.

Index 2 is one of the IMAGETYPE_XXX constants indicating the type of the image.

Index 3 is a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag.

Index 4 is mime is the correspondant MIME type of the image
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #52 (permalink)  
Old 09-20-2007, 08:14 AM
vivekanandan vivekanandan is offline
D-Web Trainee
 
Join Date: Jul 2007
Posts: 41
vivekanandan is on a distinguished road
Default Re: Image handling in php

Hi Jeyaseelan,
when creating image for the given text , is ther way to add new line in the text ,plz guide me.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #53 (permalink)  
Old 09-20-2007, 08:16 AM
vivekanandan vivekanandan is offline
D-Web Trainee
 
Join Date: Jul 2007
Posts: 41
vivekanandan is on a distinguished road
Default Re: Image handling in php

Hi,
Can one say me where we have to use GD library and where we have to use the Imagick Library.

Regards,
vivekanandan.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #54 (permalink)  
Old 09-20-2007, 08:22 AM
vivekanandan vivekanandan is offline
D-Web Trainee
 
Join Date: Jul 2007
Posts: 41
vivekanandan is on a distinguished road
Default Re: Image handling in php

Hi,
we are getting white space because of the backgroung white , just set the background as transparent & try, it will work fine .
Regards,
vivekanandan
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #55 (permalink)  
Old 09-20-2007, 08:25 AM
vivekanandan vivekanandan is offline
D-Web Trainee
 
Join Date: Jul 2007
Posts: 41
vivekanandan is on a distinguished road
Default Re: Image handling in php

Hi,
we can write text as image using any of the library like GD, Imagick, can u say for gif, & jpeg which library is good in performance .
Regards,
vivekanandan
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #56 (permalink)  
Old 09-24-2007, 02:51 AM
Anand Anand is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 52
Anand is on a distinguished road
Default Re: Image handling in php

Hi vivekanandan,

Imagemagick is much better when compared to GD. Image quality will be better in imagemagick since it uses the same DPI of the original image, also the image creation time is lesser. The only thing is image size will be little bit higher when compared to images created from GD.
__________________
None of us is As Strong as All of us.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #57 (permalink)  
Old 09-25-2007, 01:02 AM
Senthilkumar Senthilkumar is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 93
Senthilkumar is on a distinguished road
Default Re: Image handling in php

Hi All

how to create text with effects (border etc.,) using any one image libraries?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #58 (permalink)  
Old 10-03-2007, 04:38 AM
Anand Anand is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 52
Anand is on a distinguished road
Default Re: Image handling in php

Also, is there a way we can align the text using imagemagick, like center, right, left and justify using imagemagick library.
__________________
None of us is As Strong as All of us.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #59 (permalink)  
Old 10-03-2007, 08:28 AM
Senthilkumar Senthilkumar is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 93
Senthilkumar is on a distinguished road
Default Re: Image handling in php

Hi Anand,

We had implemented to align the text using imagemagick linux command(Background process). It's working fine. Try the following command to align the text in the bottom center of the image.

$vFont = "fonts/brushscript_bt.ttf";
$vText = addslashes("Happy New Year 2007");
$vInsertFile ="1mbpic_28.jpg";

exec ("convert $vInsertFile -font '$vFont' -fill '#FFFFFF' -density 70 -pointsize 45 -gravity south -annotate 0 \"$vText\" new_one.jpg");
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #60 (permalink)  
Old 10-04-2007, 05:26 AM
Anand Anand is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 52
Anand is on a distinguished road
Default Re: Image handling in php

Thanks for ur reply senthil kumar,

can you explain a bit more on what that function actually does and whats the need of -gravity south and -annotate and the purpose of these parameters in the function.
__________________
None of us is As Strong as All of us.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/php-programming/3146-image-handling-php.html
Posted By For Type Date
Anandkv's bookmarks on del.icio.us This thread Refback 08-21-2007 06:32 AM
DiscussWeb IT Community - Fusing This thread Refback 08-06-2007 03:07 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert image to other image format using CODEC in .NET 3.0 Mramesh C# Programming 0 02-07-2008 03:33 AM
How to create an image from panel background Image S.Vinothkumar C# Programming 1 10-22-2007 03:52 AM
Error Handling in PHP sivaramakrishnan PHP Programming 13 09-21-2007 05:03 AM
How can I do error handling in php? itbarota PHP Programming 0 09-12-2007 12:39 AM
Image Handling in PERL raj Perl 4 08-23-2007 12:23 AM


All times are GMT -7. The time now is 02:14 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0