Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa PHP PNG images become black colored during create image
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


ketan patil
PNG images become black colored during create image
0 Answer(s)      a year and 9 months ago
Posted in : PHP


if($sFileExtension == "PNG" || $sFileExtension == "png")
{
$img1 = @imagecreatefrompng($file);
}
else
{
    $img1 = imagecreatefromjpeg($file);
}
$width1 = @imagesx($img1);
$height1 = @imagesy($img1);
if ($width1 > $height1)
{
    $y1 = 0;
    $x1 = ($width1 - $height1) / 2;
    $smallestSide1 = $height1;
}
else
{
    $x1 = 0;
    $y1 = ($height1 - $width1) / 2;
    $smallestSide1 = $width1;
}
$thumbSize1 = 160;
$thumb1 = imagecreatetruecolor($thumbSize1, $thumbSize1);

imagecolortransparent($thumb1, imagecolorallocatealpha($thumb1, 255, 255, 255, 127));
imagealphablending($thumb1, false);
imagesavealpha($thumb1, true);
@imagecopyresampled($thumb1, $img1, 0, 0, $x1, $y1, $thumbSize1, $thumbSize1, $smallestSide1, $smallestSide1);

if($sFileExtension == "PNG" || $sFileExtension == "png")
{
    imagepng( $thumb1, $file);//third parameter is $quality its option
}
else
{
    imagejpeg( $thumb1, $file);//third parameter is $quality its option
}

Advertisement
View Answers

Related Tutorials/Questions & Answers:
PNG images become black colored during create image
PNG images become black colored during create image  if($sFileExtension == "PNG" || $sFileExtension == "png") { $img1 = @imagecreatefrompng($file..., $smallestSide1); if($sFileExtension == "PNG" || $sFileExtension == "png") { imagepng
how to re size image proportionately using java for different images like jpeg, png, gif.
how to re size image proportionately using java for different images like jpeg, png, gif.  hi, i need sample code for re size image proportionately using java for different images like jpeg, png, gif, this code for my
Advertisements
How to change the color of a base64-encoded png image JQuery?
How to change the color of a base64-encoded png image JQuery?  I am going to change the colors of the pixels of a png image(which is in base64 format...;; //"data:image/png
Retrieving images from the oracle database using jsp and create that rretrieved image as hyperlink
Retrieving images from the oracle database using jsp and create that rretrieved image as hyperlink  I want to insert images into oracle database.I want to retrieve images using jsp and I want to display on the browser.The
Convert Black & White Image to Color Image
Convert Black & White Image to Color Image       How to convert a black and white photograph... black and white image to add color. Go to image > Adjustment > Color Balance
PNG and JPG
PNG and JPG  hii, When to use PNG or JPG in iPhone development?   PNG's are pixel perfect (non-lossy), and require very little extra CPU... process. But the typical compression and image quality is usually quite sufficient
combining 5 images and text in between to one single image in java
combining 5 images and text in between to one single image in java  Hi I have to combine 5 images and text in between to one single image. I have... and create and single image for download. any help would be appreciated. Thank you
PHP GD Library, PHP GD Tutorial
The PHP GD Library is one of the most used image-processing libraries used in the PHP programs. IT is one of the robust library to create GIF, JPG and PNG images through PHP program. You can use this library to create, create thumbnail
noise during print screen
noise during print screen  hi there, i have a java program which can print screen every 1 seconds... but during the print screen, the image seems will have some noise and ends up half page of the image will be black screen
create dynamic image gallery jquery
create dynamic image gallery jquery  How to create a dynamic image gallery in Jquery
PHP GD Image into black and white
-type: image/jpeg;"); $i->imagejpeg(); class imagethumbnail { var $filename; var $x; var $y; var $image; var $thumbnail; function... ($imageinfo[2]) { case "1": $this->image = imagecreatefromgif
How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java
How To Store Multilple Images In MySQL database dynamically with image uploader and then retrieve them in image gallery using java  How To Store Multilple Images In MySQL database dynamically with image uploader
images
images  code for displaying image in java swings
How to make an animated black & white focus on the color photograph, animated black & white focus on the color photograph
How to make an animated black & white focus on the color photograph... interesting because I have tried here to make a black and white focus on the colored picture. Take a picture: First take colored picture to modify. Draw a circle
Animating Images in Java Application
images. Image are given below: In this program, images are displayed one... has been used to show images on the frame one by one during the 1000... Animating Images in Java Application   
uistatusbarstyle black translucent is not available on this device
uistatusbarstyle black translucent is not available on this device  .... And i am displaying images in a scroll view, i get this error while view get loads. uistatusbarstyle black translucent is not available on this device
How to create a JTable cell containing Image hyperlink?
How to create a JTable cell containing Image hyperlink?  I'm trying to find out how to create a JTable cell which contains Image, which should be clickable like an hyperlink. I'm able to load Image using default image renderer
How to Become a Business Analyst
How to Become a Business Analyst  How to Become a Business Analyst
Image Size
file name that has the extension either GIF, JPEG or PNG and returns an image... Image Size       This Java awt (Abstract Windowing Toolkit) tutorial describes about the image size
This is 26 set of different shades of Black covers light brown to darker Black.
:5px 0px 5px 5px; } This is 26 set of different shades of Black covers light brown to darker Black. Name/String Code Name Code Black 1 #000000 Black 2 #0B0000
Black Berry Programming - MobileApplications
Black Berry Programming  Hi friends i would like to build an application for blackberry thats creating a radio for that blackberry it as to work with the GPRS will any one give guidence for me i am learner now i know some
pngcrush caught libpng error not a png file
pngcrush caught libpng error not a png file  What is " pngcrush caught libpng error not a png file " error that occurs while running my app in simulator
HOW TO BECOME A GOOD PROGRAMMER
HOW TO BECOME A GOOD PROGRAMMER  I want to know how to become good programmer   Hi Friend, Please go through the following link: CoreJava Tutorials Here you will get lot of examples with illustration where you can
how to create menubar and the below background color/image in java swing
how to create menubar and the below background color/image in java swing  how to create menubar and the below background color/image in java swing
images upload
images upload  I use netbeans IDE 6.8 How i upload any image from any folder to web page
How to color an object in the black white photograph, color an object in the black white photograph,
How to color an object in the black & white photograph... object in the black and white photograph, follow all the steps that are shown in this example. Take picture: First we have to capture any black
php gd image create from string
' . '8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg=='; $String = base64_decode($String); $image = imagecreatefromstring($String); if ($image !== false) { header('Content-Type: image/png'); imagepng($image); } else { echo 'An error occured.'; } ?> After running
PHP GD transparent png
($im, 255, 0, 0); $black = imagecolorallocate($im, 0, 0, 0); imagecolortransparent($im, $black); imagefilledrectangle($im, 4, 4, 50, 25, $red...;Transparent image created and saved successfully."); ?> After
Image Control in Flex4
, PNG and SWF file. You can import these files in your application using Image control. Flex importing GIF, JPEG, PNG, and SWF files at run time...Image control in Flex4: The Image Control is a MX component. It has no Spark
Images in java
Images in java  how to handle images in java
How to become a PHP Developer?
In this section we will show you the steps you need to follow to become a good... to become a PHP Developer. You will definitely find this step-by-step tutorial very.... To become a PHP developer following the following steps: How to become PHP
 

 

 

DMCA.com