Thank you again for your interest in my project's issue.
After sending the previous mail I tried to fix the bug in im_copy by
myself, but I didn't noticed the problem on the line you mentioned, so I
had a look at the IM documentation and I found a "quick & dirty" solution -
I reimplemented the conversion process for LED using the
imImageCreateBased(), imConvertColorSpace() and imFileSaveImage() functions
(here is the actual version
https://github.com/gianluca-nitti/iup-cp-boilerplate/blob/master/tools/im_copy.cpp
and here the diff with the original
https://github.com/gianluca-nitti/iup-cp-boilerplate/commit/b5013047e5ceebfce28bae89f8ec85551db2109d
).
I know it probably isn't the best solution since (I think) the program now
handles only one image at time, however it's absolutely enough for the
simple purpose I need the converter for.
Again thank you very much Antonio and all you developers here on this list
for providing powerful tools like IUP and IM and for caring about user's
issues with your software.
Regards,
Gianluca
2016-02-15 17:42 GMT+01:00 Antonio Scuri <[email protected]>:
> Hi,
>
> Yes, you can do any changes. The MIT license is very flexible.
>
> About the bug is in line 122:
>
> imFileGetPalette(ifile, palette, &palette_count);
> imFileSetPalette(ofile, palette, palette_count); <<<<<
>
> Let me know if it solved your problem.
>
> Best,
> Scuri
>
>
>
> On Wed, Feb 3, 2016 at 9:28 AM, Gianluca Nitti <[email protected]
> > wrote:
>
>> Thank you very much for the your response.
>> I searched in the IM website and I found the example im_copy.cpp which is
>> probably the one you meant.
>> I downloaded the prebuilt IM binaries, the example, and I compiled it with
>>
>> g++ im_copy.cpp -Iim/include im/libim.a -lz -o im_copy
>>
>> and I got the im_copy binary. So, with
>>
>> ./im_copy icon.ico icon.led LED
>>
>> I can get the .led version of the icon, which I can then compile to C
>> together with other LED GUIs using ledc. And, it works in tty/headless
>> environments too, so my Travis build is now passing.
>>
>> I made a small change in im_copy.cpp since for some reason it was
>> returning 1 instead of 0 as exit code when all was working correctly (the
>> output file was correctly built) which was breaking my Makefile, so I
>> changed the return code in the im_copy source. I think this is allowed
>> since like IUP, IM is MIT-licensed (please correct me if I'm wrong) so I
>> can redistribute my open source changes (I have a line saying that IUP and
>> IM are copyrighted by Tecgraf\PUC-Rio and released under the MIT license in
>> my repository (which is MIT-licensed too) README and LICENSE files).
>>
>> There is still a little problem however: the produced icon is in
>> black&white (it's displayed in grayscale in my application, and if I
>> convert the icon.led back to an image format like PNG or JPEG with im_copy
>> I get a grayscale image as well). Seems like the conversion to LED discards
>> colors. I also tried with source images in formats other than .ico (.png
>> for example) and I got the same result.
>>
>> I'll try to learn more about IM to try to fix im_copy (however if you
>> tell me that's an already known issue I'll give up on this and stick with
>> the grayscale icon on Linux).
>>
>> Thank you again for the suggestion.
>>
>> Regards,
>> Gianluca
>>
>>
>> 2016-02-02 12:47 GMT+01:00 Antonio Scuri <[email protected]>:
>>
>>> Hi,
>>>
>>> I'm away from my desktop, but some operations in IupView require
>>> IupOpen, so it will depend on gtk, even if not using it directly.
>>>
>>> It is possible to use IM to build a converter from an image file to
>>> LED. One of the samples is a converter.
>>>
>>> Best,
>>> Scuri
>>> Em 31/01/2016 22:03, "Gianluca Nitti" <[email protected]>
>>> escreveu:
>>>
>>>> Hi List,
>>>> I'm using the IUP library in C and I'm having a little problem with the
>>>> build toolchain. I have a Makefile which compiles LED files into C source
>>>> with the ledc tool, and then compiles the applications for different
>>>> platforms (Windows and Linux) using GCC\MingW. Everything worked OK until I
>>>> decided to add an icon to the application's main dialog. For the Windows
>>>> target there are no problems since I can just include the icon file in a
>>>> .rc file which is then compiled using the windres tool.
>>>>
>>>> However, I had to find another way to bundle the icon with the ELF file
>>>> on Linux and allow it to be loaded at runtime. I found that the IupView
>>>> tool allows to convert from various image file formats (including .ico) to
>>>> C source code, which can then be compiled together with the application. I
>>>> set up the appropriate code and added a call to IupView in my Makefile to
>>>> compile the icon to C source before compiling everything with GCC, and when
>>>> I typed make on my local Ubuntu Desktop 14.04 machine everything worked
>>>> flawlessy and I got the working binary file with the icon.
>>>> The problem came when I pushed my code to GitHub: the Travis-CI build
>>>> was broken due to IupView not being able to run. The error I got is:
>>>>
>>>>> GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT
>>>>> (object)' failed
>>>>>
>>>> (you can see the Travis log here:
>>>> https://travis-ci.org/gianluca-nitti/iup-cp-boilerplate/builds/105170362
>>>> ).
>>>>
>>>> I later tried on an Ubuntu Server virtual machine, and I got the same
>>>> error message; for a while I thought there was some library required by
>>>> IupView which isn't installed on Ubuntu Server, but then I tried to switch
>>>> to a TTY on the Ubuntu Desktop machine where everything works OK from the
>>>> GNOME terminal emulator, and I got the same error.
>>>>
>>>> Basically, I found that the IupView command with the appropriate
>>>> arguments to convert an image works from a desktop-based terminal emulator,
>>>> but not from a text-only shell, which is the only option on most
>>>> server-like environments. This is a bit annoying since doesn't allow the
>>>> image conversion to work in a continuous integration build system. Is there
>>>> a way to solve this?
>>>>
>>>> Thank you very much for any help, and sorry if my English isn't very
>>>> good but it's not my primary language.
>>>>
>>>> Regards,
>>>> Gianluca
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>>>> Monitor end-to-end web transactions and take corrective actions now
>>>> Troubleshoot faster and improve end-user experience. Signup Now!
>>>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>>>> _______________________________________________
>>>> Iup-users mailing list
>>>> [email protected]
>>>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>>>
>>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>>> Monitor end-to-end web transactions and take corrective actions now
>>> Troubleshoot faster and improve end-user experience. Signup Now!
>>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>>> _______________________________________________
>>> Iup-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
>> _______________________________________________
>> Iup-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/iup-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> Iup-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/iup-users
>
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Iup-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/iup-users