Well… any usual conversion from UTF-16 to char* (not sure if you expect to 
store UTF-8 or whatever else encoding, I also don’t remember from the top of my 
head which encoding libpng/the PNG specification expects).

This is a bit off-topic for lcms ☺ You should find plenty of options on google.

Marco


Von: Aaron Boxer [mailto:boxe...@gmail.com]
Gesendet: Montag, 27. Februar 2017 10:20
An: Marco Freudenberger
Cc: lcms-user@lists.sourceforge.net
Betreff: Re: [Lcms-user] Extract name from ICC profile

Cool. So, this gives an array of wchar_t.
I need to pass this to libpng, which is expecting a pointer to char.
Is there an easy way of converting?
Thanks
Aaron

On Mon, Feb 27, 2017 at 11:06 AM, Marco Freudenberger 
<marco.freudenber...@entrustdatacard.com<mailto:marco.freudenber...@entrustdatacard.com>>
 wrote:
Not sure if it’s the best way, here’s a sniplet of what I was using once to get 
the display name (C++11):

// assuming you have the profile open – hprofile is the handle to the profile
cmsUInt32Number bufferSize = cmsGetProfileInfo(hprofile, cmsInfoDescription, 
cmsNoLanguage, cmsNoCountry, nullptr, 0);
size_t numWideChars = (bufferSize + 1) / 2;
std::unique_ptr<wchar_t[]> description(new wchar_t[numWideChars]);
cmsUInt32Number result = cmsGetProfileInfo(hprofile, cmsInfoDescription, 
cmsNoLanguage, cmsNoCountry, description.get(), bufferSize);

Note that you might want to check if the profile name is available a certain 
language….
You also could directly store it to a pre-sized std::wstring rather than the 
unique_ptr<wchar_t[]>; I don’t remember why Idid it that way.

Marco

Von: Aaron Boxer [mailto:boxe...@gmail.com<mailto:boxe...@gmail.com>]
Gesendet: Montag, 27. Februar 2017 09:58
An: lcms-user@lists.sourceforge.net<mailto:lcms-user@lists.sourceforge.net>
Betreff: [Lcms-user] Extract name from ICC profile

Hello Again,
What is the best way of using lcms to extract an ICC profile name?
Thanks so much,
Aaron

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Lcms-user mailing list
Lcms-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lcms-user

Reply via email to