KFreon / CSharpImageLibrary

Image processing library written entirely in C#.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Saving floating point image data as DDS_ARGB_32F large file size unusable DDS

GijsVerheijen opened this issue · comments

commented

ImageEngineImage img = new ImageEngineImage(memoryStream); img.Save(path, new ImageFormats.ImageEngineFormatDetails(ImageEngineFormat.DDS_ARGB_32F), MipHandling.Default);

I created an image 1920x1200 containing floating point rgb values, im trying to save them to a DDS using the ImageEngineImage but the export for "ImageEngineFormat.DDS_ARGB_32F" gives me a huge file (200mb+) . This file is not opening up in Photoshop or any other tool.

When I export the image data as Format RGBA8 it is working fine and the output DDS is usable (11mb). I need the RGB values in floating percision, any ideas?

commented

So saving as ARGB_32F doesn't work for your input data?
Could you provide a sample file for testing?

commented

Added an example image

c

Also added a wetransfer link of the output, it doesnt allow me to upload a zip for some reason
https://wetransfer.com/downloads/e2b3fb9673eb5db8709737bd9ba593a120170612074910/46ce7f04eb209a8d108641485341040e20170612074910/6cfb86

commented

Alright. I'll take a look this week sometime.

commented

Ok I think I fixed it. I'll do some more testing, but this will be in the next update once I've figured out BC6 compression...

commented

Fixed!

commented

It is still producing an unknown image format for me, but the image size is significantly smaller (~200mb to 47mb)
`
ImageEngineImage img = new ImageEngineImage(@"C:/Desktop/combined.bmp");

img.Save(path, new ImageFormats.ImageEngineFormatDetails(ImageEngineFormat.DDS_ARGB_32F), MipHandling.Default);`

commented

Interesting. I got the rainbow image above and converted it to ARGB_32F with the tool, then opened it in the tool and in Photoshop, and it worked for me.
In what way are you getting it to break?

commented

It is opening in Photoshop and in your tool but not in other tools such as PicoPixel and in the game engine im using which is using Ogre. Saving the file in photoshop makes the image usable in these programs. I noticed that the following items of the header change when I do this.

dwFlags: DDPF_ALPHAPIXELS, DDPF_RGB (Original, not working in engine and PicoPixel)
dwFlags: DDPF_FOURCC (After saving in Photoshop, working in engine and PicoPixel)

What im trying to do here is saving the image containing floating point data shouldnt the dwFlag be DDPF_FOURCC for floating point argb? See remarks section:

"To store DXGI formats such as floating-point data, use a dwFlags of DDPF_FOURCC and set dwFourCC to 'D','X','1','0'. Use the DDS_HEADER_DXT10 extension header to store the DXGI format in the dxgiFormat member."

source:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb943984(v=vs.85).aspx

commented

Hmm I'll take a look at how I do the headers. I thought it should already have those flags set, but evidently not.

commented

OK I think I fixed it.

commented

It is still doing something wrong with the conversion, if I convert im getting a distortion, but if I then convert the distorted image again, im getting a correct format. I have a download link with the results:
(https://we.tl/JvrK5ew9O9)
original.DDS
firstconversion.DDS (this one is distorted)
secondconversion.DDS (this is a conversion of the distorted image)

commented

What on Earth is going on here...
I'll see what I can do, no timeline atm though. Getting busy on my end.

commented

[Uploading Fix for ARGB32F.zip…](Give this one a go.) Should be fixed now.
I tested it in PicoPixel to be sure this time. Didn't read properly and missed that bit last time.

commented

@KFreon Where can I find the link for the fix? Ill give it a go

commented

Oh that didn't work...How strange.
Fix for ARGB32F.zip