PNG images become black colored during create image

PNG images become black colored during create image

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
}
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
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
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
Convert Black & White Image to Color Image
Convert Black & White Image to Color Image       How to convert a black and white photograph..._TO_REPLACE_3 Color Setting: Now you have a selected black and white image to add color
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
create dynamic image gallery jquery
create dynamic image gallery jquery  How to create a dynamic image gallery in Jquery
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... complicated decoding process. But the typical compression and image quality is usually
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
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
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
Animating Images in Java Application
images. Image are given below: ADS_TO_REPLACE_1 In this program, images... by one during the 1000 milliseconds. This collection of images makes... Animating Images in Java Application   
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
images
images  code for displaying image in java swings
Image Size
or PNG and returns an image in pixels. It takes string type file name... Image Size       This Java awt (Abstract Windowing Toolkit) tutorial describes about the image size
ModuleNotFoundError: No module named 'colored'
ModuleNotFoundError: No module named 'colored'  Hi, My Python... 'colored' How to remove the ModuleNotFoundError: No module named 'colored... to install padas library. You can install colored python with following command
ModuleNotFoundError: No module named 'colored'
ModuleNotFoundError: No module named 'colored'  Hi, My Python... 'colored' How to remove the ModuleNotFoundError: No module named 'colored... to install padas library. You can install colored python with following command
PHP GD Image into black and white
(); header("Content-type: image/jpeg;");ADS_TO_REPLACE_2 $i->imagejpeg... $image;ADS_TO_REPLACE_4 var $thumbnail; function imagethumbnail() { }ADS...;image = imagecreatefromgif($this->filename); break; case "2"
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.ADS_TO_REPLACE_1
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
ModuleNotFoundError: No module named 'colored-glog'
ModuleNotFoundError: No module named 'colored-glog'  Hi, My Python... 'colored-glog' How to remove the ModuleNotFoundError: No module named 'colored-glog' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'colored-traceback'
ModuleNotFoundError: No module named 'colored-traceback'  Hi, My... named 'colored-traceback' How to remove the ModuleNotFoundError: No module named 'colored-traceback' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'colored-traceback'
ModuleNotFoundError: No module named 'colored-traceback'  Hi, My... named 'colored-traceback' How to remove the ModuleNotFoundError: No module named 'colored-traceback' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'colored-glog'
ModuleNotFoundError: No module named 'colored-glog'  Hi, My Python... 'colored-glog' How to remove the ModuleNotFoundError: No module named 'colored-glog' error? Thanks   Hi, In your python
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
php gd image create from string
$image = imagecreatefromstring($String); if ($image !== false) { header('Content-Type: image/png');ADS_TO_REPLACE_3 imagepng($image); } else {ADS
images upload
images upload  I use netbeans IDE 6.8 How i upload any image from any folder to web page
ModuleNotFoundError: No module named 'myon-png'
ModuleNotFoundError: No module named 'myon-png'  Hi, My Python... 'myon-png' How to remove the ModuleNotFoundError: No module named 'myon-png... to install padas library. You can install myon-png python with following
ModuleNotFoundError: No module named 'png_util'
ModuleNotFoundError: No module named 'png_util'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'png_util' How to remove the ModuleNotFoundError: No module named 'png_util
ModuleNotFoundError: No module named 'png_util'
ModuleNotFoundError: No module named 'png_util'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'png_util' How to remove the ModuleNotFoundError: No module named 'png_util
Version of com.keypoint>png-encoder dependency
List of Version of com.keypoint>png-encoder dependency
ModuleNotFoundError: No module named 'black'
ModuleNotFoundError: No module named 'black'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'black' How to remove the ModuleNotFoundError: No module named 'black'
Java Script With Links and Images
of JavaScript and create your first JavaScript program. JavaScript Images... that need to be edited to create JavaScript image swapping.  The JavaScript... (the default image, in this case black) then changes to display a second image
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
image processing - Java3D
image processing  hii i have to compare 2 images. for this i try to convert image into greyscale. i think the greyscale comparisonn is more.... The sample code below shows how to draw the colored image to a gray scale
Image Demo
Image Demo       This section simply display the image demo that means multiple images and its name are based on the frame to a particular location. For displaying images demo
Java Write To Image File Example
need to do the following At first create an instance of your original Image file as /* Create new Image File Object */ File origionalImage = new File("myImage.jpg"); Create an ImageBuffer object of Origional Image asADS_TO_REPLACE_1
ModuleNotFoundError: No module named 'colored_slack_log_handler'
ModuleNotFoundError: No module named 'colored_slack_log_handler'  Hi...: No module named 'colored_slack_log_handler' How to remove the ModuleNotFoundError: No module named 'colored_slack_log_handler' error? Thanks  
ModuleNotFoundError: No module named 'colored_slack_log_handler'
ModuleNotFoundError: No module named 'colored_slack_log_handler'  Hi...: No module named 'colored_slack_log_handler' How to remove the ModuleNotFoundError: No module named 'colored_slack_log_handler' error? Thanks  
ModuleNotFoundError: No module named 'colored_slack_log_handler'
ModuleNotFoundError: No module named 'colored_slack_log_handler'  Hi...: No module named 'colored_slack_log_handler' How to remove the ModuleNotFoundError: No module named 'colored_slack_log_handler' error? Thanks  
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
Images in java
Images in java  how to handle images in java
Maven Repository/Dependency: com.keypoint | png-encoder
Maven Repository/Dependency of Group ID com.keypoint and Artifact ID png-encoder. Latest version of com.keypoint:png-encoder dependencies... at: Maven Tutorials What is Apache Maven? How to create Maven
background images in css not working
background images in css not working  In the application i'm passing a background image from CSS in the given format ... background-image: url("Image\backgroundImage.GIF"); which is not working. So, please give me an example
PHP GD image Character up
.';ADS_TO_REPLACE_1 $bg = imagecolorallocate($im, 255, 0, 0); $black = imagecolorallocate($im, 0, 0, 0); imagecharup($im, 5, 13, 13, $string, $black);ADS_TO_REPLACE_2 header('Content-type: image/png'); imagepng($im); ?>
how can create pop() method in this program ,Or how can delete image in it when i press pop button in runtime ??? please help me ...
how can create pop() method in this program ,Or how can delete image in it when... the pet images and create an array of indexes. images = new ImageIcon...) { images[i].setDescription(aray[i]); } } //Create
ModuleNotFoundError: No module named 'png_header_injector'
ModuleNotFoundError: No module named 'png_header_injector'  Hi, My... named 'png_header_injector' How to remove the ModuleNotFoundError: No module named 'png_header_injector' error? Thanks   Hi
ModuleNotFoundError: No module named 'png_header_injector'
ModuleNotFoundError: No module named 'png_header_injector'  Hi, My... named 'png_header_injector' How to remove the ModuleNotFoundError: No module named 'png_header_injector' error? Thanks   Hi
ModuleNotFoundError: No module named 'thumbor-png-optimizers'
ModuleNotFoundError: No module named 'thumbor-png-optimizers'  Hi...: No module named 'thumbor-png-optimizers' How to remove the ModuleNotFoundError: No module named 'thumbor-png-optimizers' error? Thanks   Hi
ModuleNotFoundError: No module named 'dffml-config-png'
ModuleNotFoundError: No module named 'dffml-config-png'  Hi, My... named 'dffml-config-png' How to remove the ModuleNotFoundError: No module named 'dffml-config-png' error? Thanks   Hi, In your

Ads