Closed mrcode86 closed 8 years ago
The background color is not automatically set for transparent images, but you could achieve this by first creating an image with the right color and then paste your png over it (using the BlitImage function). The code would look like this:
using (var Temp = System.Drawing.Image.FromStream(str))
{
using (var Image = new KalikoImage(Temp.Width, Temp.Height, Color.White))
{
Image.BlitImage(Temp);
using (var DoneStr = new MemoryStream())
{
Image.SaveJpg(DoneStr, 90);
DoneStr.Position = 0;
// Save stream
}
}
}
Perfect. Thanx for your help and for a nice library. =)
I found a problem with this code. When i save a jpg image, i get this: https://img.myclosetroom.com/upload/user1/original/az_635633287903244562.jpg
and when i use using (var Image = new KalikoImage(str)) { using (var DoneStr = new MemoryStream()) { Image.SavePng(DoneStr); DoneStr.Position = 0; } } i get this: https://img.myclosetroom.com/upload/user1/original/az_635633287903244562.png and thats correct. So whats wrong with the jpg image?
It seems to have been an issue with image resolution (pixels per inch) when loading images through streams. I've fixed the issue in this branch: https://github.com/fschultz/NetImageLibrary/tree/image-load-fix
Strangely I got the same error for both the jpg and png output. But I hope this will solve the problem you are seeing as well.
When i try to create a jpg from a png stream, tha background of the jpg image is black. I try this:
What is wrong?