Gimp-Forum.net
Trying to import a 16-bit grayscale .dds (heightmap) without converting to 8-bit - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: General questions (https://www.gimp-forum.net/Forum-General-questions)
+--- Thread: Trying to import a 16-bit grayscale .dds (heightmap) without converting to 8-bit (/Thread-Trying-to-import-a-16-bit-grayscale-dds-heightmap-without-converting-to-8-bit)



Trying to import a 16-bit grayscale .dds (heightmap) without converting to 8-bit - mikusingularity - 09-24-2020

I am trying to modify a 8192 x 4096 16-bit .dds heightmap of the Earth, but whenever I import it, it always converts to 8-bit. Is there any way I can import without it becoming 8-bit? Or if GIMP cannot do that, which program can?


RE: Trying to import a 16-bit grayscale .dds (heightmap) without converting to 8-bit - rich2005 - 09-25-2020

Can you post a link to one of these files, the only example dds I have is 8 bit (per channel) as reported by ImageMagick and a search only brings up the same.


RE: Trying to import a 16-bit grayscale .dds (heightmap) without converting to 8-bit - bram - 11-18-2020

(09-25-2020, 07:57 AM)rich2005 Wrote: Can you post a link to one of these files, the only example dds I have is 8 bit (per channel) as reported by ImageMagick and a search only brings up the same.

I have the same issue.

I created my image with this header:

Code:
       DDS_PIXELFORMAT pf =
       {
               32,             // SIZE
               0x20000,        // DDPF_LUMINANCE
               0,              // FOUR CC
               16,             // RGB BIT COUNT
               0x0000ffff,       // R BIT MASK
               0,              // G BIT MASK
               0,              // B BIT MASK
               0,              // A BIT MASK
       };

       DDS_HEADER header =
       {
               124,                            // SIZE
               0x1 | 0x2 | 0x4 | 0x1000,       // FLAGS
               imh, imw,                       // HEIGHT,WIDTH
               0,0,0,                          // PITCH,DEPTH,MIPMAP
               { 0,0,0,0,0,0,0,0,0,0,0, },     // RESERVED
               pf,                             // PIXEL FORMAT
               0x1000,                         // CAPS
               0,                              // CAPS2
               0,                              // CAPS3
               0,                              // CAPS4
               0,                              // RESERVED
       };

Here's an example 16 bit luminosity file, I created:

https://stolk.org/tmp/out.dds


RE: Trying to import a 16-bit grayscale .dds (heightmap) without converting to 8-bit - rich2005 - 11-19-2020

No further forward here. Still opens in Gimp as 8 bit and ImageMagick also thinks it is 8 bit.

Code:
Image:
  Filename: out.dds
  Format: DDS (Microsoft DirectDraw Surface)
  Class: DirectClass
  Geometry: 1024x1024+0+0
  Units: Undefined
  Colorspace: sRGB
  Type: Bilevel
  Base type: Undefined
  Endianness: LSB
  Depth: 8/1-bit
  Channel depth:
    Red: 1-bit
    Green: 1-bit
    Blue: 1-bit
  Channel statistics:
    Pixels: 1048576
    Red:
      min: 255  (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 8.192e+51
      skewness: 1e+36
      entropy: 0
    Green:
      min: 255  (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 8.192e+51
      skewness: 1e+36
      entropy: 0
    Blue:
      min: 255  (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: 8.192e+51
      skewness: 1e+36
      entropy: 0
  Image statistics:
    Overall:
      min: 255  (1)
      max: 255 (1)
      mean: 255 (1)
      standard deviation: 0 (0)
      kurtosis: -2.86314e+57
      skewness: 4.36886e+40
      entropy: 0
  Colors: 1
  Histogram:
    1.04858e+06: (255,255,255) #FFFFFF white
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Matte color: grey74
  Background color: white
  Border color: srgb(223,223,223)
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 1024x1024+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: None
  Orientation: Undefined
  Properties:
    date:create: 2020-11-19T08:18:22+00:00
    date:modify: 2020-11-19T08:18:22+00:00
    signature: 7ce0ffd942046e8bac1f3445cb712b65665c26278b4884ff49918c5e16a9da29
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 2097280B
  Number pixels: 1.04858M
  Pixels per second: 145.135MP
  User time: 0.010u
  Elapsed time: 0:01.007
  Version: ImageMagick 7.0.10-21 Q16 x86_64 2020-06-27 https://imagemagick.org



RE: Trying to import a 16-bit grayscale .dds (heightmap) without converting to 8-bit - bram - 11-19-2020

(11-19-2020, 01:22 PM)rich2005 Wrote: No further forward here. Still opens in Gimp as 8 bit and ImageMagick also thinks it is 8 bit.

I think both ImageMagick and Gimp are mistaken.

Code:
$ sudo apt install libnvtt-bin

Code:
$ nvddsinfo out.dds
Flags: 0x00001007
    DDSD_CAPS
    DDSD_PIXELFORMAT
    DDSD_WIDTH
    DDSD_HEIGHT
Height: 1024
Width: 1024
Depth: 0
Mipmap count: 0
Pixel Format:
    Flags: 0x00020000
    FourCC: ''
    Bit count: 16
    Red mask: 0x0000FFFF
    Green mask: 0x00000000
    Blue mask: 0x00000000
    Alpha mask: 0x00000000
Caps:
    Caps 1: 0x00001000
        DDSCAPS_TEXTURE
    Caps 2: 0x00000000
    Caps 3: 0x00000000
    Caps 4: 0x00000000

It clearly states: bitcount 16, and mask 0x0000ffff

Additionally, Ubuntu's 'file' command also correctly identifies it!


Code:
$ file ./out.dds
./out.dds: Microsoft DirectDraw Surface (DDS): 1024 x 1024, 16-bit color, luminance



RE: Trying to import a 16-bit grayscale .dds (heightmap) without converting to 8-bit - bram - 11-19-2020

Let me note further that this is a DDS specific bug, as PGM images 16 bit deep, are correctly loaded by GIMP with 16 bit precision.


RE: Trying to import a 16-bit grayscale .dds (heightmap) without converting to 8-bit - rich2005 - 11-19-2020

Yeah, looks like not supported by Gimp.

Since the dds plugin is now incorporated in Gimp 2.10 you can report this as a bug to

https://gitlab.gnome.org/GNOME/gimp/-/issues