I am trying to save a png file in database using C#.
Bitmap thumbnail = new Bitmap(file.InputStream);
thumbnail = ImageUtilities.ResizeImage(thumbnail, Convert.ToInt32(width),Convert.ToInt32(height)); ImageUtilities.SaveJpeg(path,thumbnail,Convert.ToInt32(Resources.AppConstants.ExtractThumbnailQuality);
The image gets saved in database, but with a black background around the image. In short, it loses its transparency.
If I skip the resizing of image, instead of black background, a white background appears around the image.
Can anyone suggest, how to preserve the tranparency of the image
You are saving the resized image as JPEG. JPEG does not support transparency. Save it as PNG instead
Related
When I'm inserting our company logo into Oracle Report there is a grey background on the logo. The logo is file type BMP, I have tried different file types like JPEG and TIFF as well. The issue still remains the grey background.
Below is the example of that grey background.
As you can see the portion which has the logo has a grey background whereas the background of the report is white. This is totally against our company guidelines and I've been told to find a solution for this. Please advise how can I remove the grey background.
Thanks
if you want to remove the background of the image then use an editing tool like photoshop and then remove the background and save the image as png then convert into bmp and then use it in your report.
i can't remove the white background when saving as png or jpeg.
tried everything what suggested me on the web, but still get the diminsions i set up as whitebackground.
How can i save image without the background?
see image below for settings.
enter image description here
if you want to remove all the white from the picture, better go to color range and sample white. layer via cut and delete the layer. and save it in png as #cybernatic.nomad said, supports transparency.
Make sure you have created your image on a new layer and delete (or hide) the first white layer. I just created a simple text on a new layer with a transparent background and then loaded the image back into Photoshop to confirm that it works properly. As per previous comment I use .png format to preserve transparency.
I am using a CodeJock ImageManager component to hold a variety of images. I want to put one of these images into a FlexGrid Cell.
The Images I have are Png format and have transparent backgrounds so when I load the image into the grid like so:
Grid.Cell(flexcpPicture, 123, 4) = _
ImageManagerControl.Icons.GetImage(ImageNum, 16).CreatePicture(xtpImageNormal)
the background which in the original image was transparent is now black:
(the same happens if I load the image into a PictureBox using the above method)
According to the documentation CreatePicture returns an StdPicture object, is there some way I can convert this image (using BitBlt perhaps) so that the black is white? I'm not sure if this even possible?
I only need to do this with about three images so if I have to load them into an ImageList or something else first that would be ok.
I'm not sure if this helps at all, but I've been playing around with the PictureBox. I put two picture boxes on a form, put a bmp file (this only works with bmp files, so it might not be helpful to you), and did this:
Picture2.PaintPicture Picture1.Picture, 0, 0, opcode:=vbNotSrcCopy
Which successfully inverted the bitmap. Here are the RasterOp constants: http://msdn.microsoft.com/en-us/library/aa243035(v=vs.60).aspx
In Mac OSX,
I have an image with black pixel in all 4 directions.
I want to programmatically crop the image to the maximum image rect.
Should i check for the black pixel and then create the crop rect or is there any supported API is there?
Create an NSImage of the desired size, lock focus on it, draw the desired crop rectangle of the source image into the whole bounds of the destination image, and unlock focus. The image you created now contains the crop from the source image.
Note that this will lose information like resolution (DPI), color profile, and EXIF tags. If you want to preserve those things (probably a good idea), use CGImage:
Use CGImageSource to load the image. Be sure to recover the properties of each image from the file, as well as the images themselves. And note that I used the plural: TIFF files can contain multiple images.
Use the CGImageCreateWithImageInRect function to crop out the desired section of each image. Don't forget to release each original image as appropriate.
If you want to write the cropped-out images to a file, do so using CGImageDestination. Pass both the images and the attributes dictionaries you obtained in step 1.
So I have an image (GIF) with a blueish background and a circle (which i want to keep), I would like to remove the blueish background and ( or show the origin color of the back ground it sites on or make the background of the image totally transparent. )
Thank you .
This is GWT 1.6
GIF supports transparency also, open it in a image editor(not paint, it sucks) and select the background using the magic wand tool. Press delete and you're done!
PS: save it as GIF file if you have to..
This has nothing to do with GWT. The solution is to use PNG image format. PNGs allow you to specify a transparent background.