DDS format / mipmaps parameter

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
florianlabas
Posts: 5
Joined: 2015-03-08T14:44:54-07:00
Authentication code: 6789

DDS format / mipmaps parameter

Post by florianlabas »

Hi,

i''m trying the convert files to DDS
and it seems that dds:mipmaps is not working

convert -format dds -define dds:mipmaps=5 -define dds:compression=dxt1 Sudoku1.png Sudoku1.dds

dds:compression works fine, but not mipmaps
Have seen in the source code some "skip mipmaps", was it releavant ?

Thanks !
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: DDS format / mipmaps parameter

Post by dlemstra »

How do you know that the mipmaps are not working?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
florianlabas
Posts: 5
Joined: 2015-03-08T14:44:54-07:00
Authentication code: 6789

Re: DDS format / mipmaps parameter

Post by florianlabas »

Hi,

I tried to load the DDS file under Photoshop with NVIDIA Texture extension that reveal mipmaps
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: DDS format / mipmaps parameter

Post by dlemstra »

Is the size of your image a square root of two?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
florianlabas
Posts: 5
Joined: 2015-03-08T14:44:54-07:00
Authentication code: 6789

Re: DDS format / mipmaps parameter

Post by florianlabas »

Sure !
florianlabas
Posts: 5
Joined: 2015-03-08T14:44:54-07:00
Authentication code: 6789

Re: DDS format / mipmaps parameter

Post by florianlabas »

Hey there,

here's some output file
I test on severals DDS reader and i'm pretty sure IM don't generate mipmap
Is it a IM bug ?

Original image :
http://s000.tinyupload.com/?file_id=028 ... 6611448232

With IM
http://s000.tinyupload.com/?file_id=307 ... 6001547879

With Photoshop and Nvidia DDS creator
with mipmap
http://s000.tinyupload.com/index.php?fi ... 2832531134

without mipmap
http://s000.tinyupload.com/index.php?fi ... 6383862298
florianlabas
Posts: 5
Joined: 2015-03-08T14:44:54-07:00
Authentication code: 6789

Re: DDS format / mipmaps parameter

Post by florianlabas »

Of course, here's the square of 2 management :

Code: Select all

                    LImage.SourceDimensionX = image.Width
                    LImage.SourceDimensionY = image.Height

                    Dim width_def As Integer = LImage.SourceDimensionX
                    Dim height_def As Integer = LImage.SourceDimensionY

                    If (LImage.SourceDimensionX Mod 4 > 0) Then width_def = LImage.SourceDimensionX - (LImage.SourceDimensionX Mod 4) + 4
                    If (LImage.SourceDimensionY Mod 4 > 0) Then height_def = LImage.SourceDimensionY - (LImage.SourceDimensionY Mod 4) + 4

                    If (width_def > LImage.SourceDimensionX) Or (height_def > LImage.SourceDimensionY) Then
                        image.Extent(width_def, height_def, Gravity.Center)
                    End If
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: DDS format / mipmaps parameter

Post by dlemstra »

That code does not look valid. Your image should be square and be a power of two. (128, 256, 512). Sorry for using an incorrect term earlier, English is not my native language.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: DDS format / mipmaps parameter

Post by snibgo »

?? 128 and 512 are powers of 2, but are not squares. Number that are both square, and powers of 2, would include 4, 16, 64, 256, 1024.
snibgo's IM pages: im.snibgo.com
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: DDS format / mipmaps parameter

Post by dlemstra »

The image should be square e.g. 128x128, 256x256. Once more I apologize for the confusion...
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply