Notifications
Clear all

[Closed] ImgTag woes

I’m applying .PNG images to imgTags in maxscript and the images are being displayed too dark.
This is because max 2012 turns on gamma settings by default, and the imgTag takes that into account. (source).

Now, I’ve looked around for solutions and came across a few, none of which work for me.
I’ve referenced the help, which gives an example that is too verbose for me, and also doesn’t apply in the context of how I’m loading in images into imgTags. From the help:


 b = bitmap 320 240 gamma:displayGamma 
 render camera:c to:b
 

I’ve tried the fileInGamma trick, which doesn’t work as expected:


 fileIngamma = 1.0 --set the gamma 
 ImgTag headOneBtn bitmap:(openBitmap (url+"headOne.png")) pos:[0,0] width:17 height:6 
 fileIngamma = 2.2 --set the gamma back
 

Error in listener:
– Syntax error: at =, expected name
– In line: fileIngamma = 1

The syntax I’d prefer to use for imgTags would be like this:


  ImgTag myBtn bitmap:(openBitmap ("myImage.png")) pos:[10,10] width:50 height:50 [b]gamma:1.0[/b]
  

Is there any equivalent maxscript that would let me set the gamma for an imgTag as I create it?

Also – and this is a little bit off topic – in this blog Chris Johnson presents some C# code that modifies the file maxsdk\include\bitmap.h. Is it possible to update this file with Chris’ code, and then somehow compile that, so imgTags work as expected? I apologize if that is a fundamental question – I’m just getting my feet wet with the SDK and C#/C++.

3 Replies

Yes, this is annoying me as well. Maybe file a bug with Autodesk, although I’m sure they know about it…

This was from a conversation between Chris and I and his blog post followed after the problem was identified. Its an easy fix, but has to be done in c++ in the SDK (his code snippet is c++, not C# or .net or anything).

It doesn’t just apply to img_tag.

Since Chris works at Autodesk, with the SDK, I’m pretty sure he has already added the fix to the code for the next release.

His coding sample can be used if you want to recompile your own UI control objects with the fix.

Thanks kees! That clears up any questions I had!