Resolution information
-
On 02/01/2014 at 13:07, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R15
Platform: Windows ;
Language(s) : C++ ;---------
When I load a texture direct in a material channel, c4d show the resolution info.
How can I get this information?And what if I have textures in a layer shader.
How to get the resolution for all images in the layer shader?
-
On 02/01/2014 at 13:15, xxxxxxxx wrote:
I found an old post from Matthias.
Is this the way to go?_<_t_>_
![Direct Link To This Post
[URL-REMOVED]](https://developers.maxon.net/forum/topic/3949/3428_texturebitmapwhere-to-find-it&PID=14056#14056) Posted: 30 Jun 2008 at 5:56pmUnfortunatly the resolution or the link to the bitmap is not stored in a container. You have to check the bitmap manually, going by the path provided.
cheers,
Matthias
<_<_t_>_
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 02/01/2014 at 17:28, xxxxxxxx wrote:
I think he meant that you have to get the information from the image file manually.
Like this:Filename fn = GeGetC4DPath(C4D_PATH_DESKTOP) + "myimage.jpg"; AutoAlloc<BaseBitmap> bmp; if (IMAGERESULT_OK != bmp->Init(fn)) return FALSE; LONG bw = bmp->GetBw(); //The image width LONG bh = bmp->GetBh(); //The image height GePrint(LongToString(bw)); GePrint(LongToString(bh)); MultipassBitmap *mbmp = NULL; mbmp = MultipassBitmap::Alloc(bw, bh, COLORMODE_RGBf); if (!mbmp) return FALSE; GeData d = mbmp->GetParameter(MPBTYPE_DPI); //Gets the dpi info LONG dpi = d.GetLong(); GePrint(LongToString(dpi)); MultipassBitmap::Free(mbmp);
-ScottA
-
On 03/01/2014 at 03:45, xxxxxxxx wrote:
Yes, that is what I thought.
I use GetColorMode.orgImage->Init(fname, -1, nullptr); Int32 colorMode = orgImage->GetColorMode(); //The image colormode Int32 bw = orgImage->GetBw(); //The image width Int32 bh = orgImage->GetBh(); //The image height
Here also a translation from the Int32 colormode to a String with the colormode description
Perhaps someone might find it useful (it saves typing in).String modeToString(Int32 colorMode) { switch (colorMode) { case COLORMODE_ILLEGAL: return "Illegal"; case COLORMODE_ALPHA: return "Only 8-bit alpha channel."; case COLORMODE_GRAY: return "8-bit grayscale channel."; case COLORMODE_AGRAY: return "8-bit grayscale channel with 8-bit alpha."; case COLORMODE_RGB: return "8-bit RGB channels."; case COLORMODE_ARGB: return "8-bit RGB channels with 8-bit alpha."; case COLORMODE_CMYK: return "8-bit CMYK channel."; case COLORMODE_ACMYK: return "8-bit CMYK channel with 8-bit alpha."; case COLORMODE_MASK: return "8-bit grayscale map as mask."; case COLORMODE_AMASK: return "8-bit grayscale map as mask with 8-bit alpha."; case COLORMODE_ILLEGALw: return "Illegal."; case COLORMODE_GRAYw: return "16-bit grayscale channel."; case COLORMODE_AGRAYw: return "16-bit grayscale channel with 16-bit alpha."; case COLORMODE_RGBw: return "16-bit RGB channels."; case COLORMODE_ARGBw: return "16-bit RGB channels with 16-bit alpha."; case COLORMODE_MASKw: return "16-bit grayscale map as mask."; case COLORMODE_ILLEGALf: return "Illegal."; case COLORMODE_GRAYf: return "Floating point grayscale channel."; case COLORMODE_AGRAYf: return "Floating point grayscale channel with floating point alpha."; case COLORMODE_RGBf: return "Floating point RGB channels."; case COLORMODE_ARGBf: return "Floating point RGB channels with floating point alpha."; case COLORMODE_MASKf: return "Floating point grayscale map as mask."; default: return "Unknown Colormode: " + String::IntToString(colorMode); } }// end String modeToString(Int32 colorMode)