Re: [Imtoolkit-users] Convert loaded gif file
Brought to you by:
scuri
|
From: Milind G. <mil...@gm...> - 2014-07-19 15:18:52
|
The last line ProcessResize was causing lua to crash but using
ProcessResizeNew fixed it.
Thanks,
Milind
On Sat, Jul 19, 2014 at 6:13 AM, Antonio Scuri <sc...@te...>
wrote:
> What kind of crash?
>
> In which line?
>
> I recommend using:
>
> newimg = im.ImageCreateBased(image, 500,374, nil, nil)
> or
> newimg = im.ProcessResizeNew(image,500,374,1)
>
> Instead of directly using im.RGB.
>
> Best,
> Scuri
>
>
>
> On Sat, Jul 19, 2014 at 12:39 AM, Milind Gupta <mil...@gm...>
> wrote:
>
>> Thanks that worked for gif. Now I am having a crash problem when I am
>> processing a png file. The program that crashes is:
>>
>> require("imlua")
>> require("imlua_process")
>> require("iuplua")
>> image = im.FileImageLoadBitmap("fish.png")
>> print(image:ColorSpace() == im.MAP)
>> print(image:ColorSpace() == im.BINARY)
>> newimg = im.ImageCreate(500,374,im.RGB,im.BYTE)
>> im.ProcessResize(image,newimg,1)
>>
>> And the image is attached. The image causes Lua to crash.
>>
>>
>>
>> On Fri, Jul 18, 2014 at 5:16 PM, Antonio Scuri <sc...@te...>
>> wrote:
>>
>>> ok. Then you will need to first convert the loaded image to RGB first.
>>>
>>> if (image:ColorSpace() == im.MAP or image:ColorSpace() == im.BINARY)
>>> then
>>> new_image = im.ConvertColorSpaceNew(image, im.RGB, false)
>>> image:Destroy()
>>> image = new_image
>>> end
>>>
>>> Best,
>>> Scuri
>>>
>>>
>>> On Fri, Jul 18, 2014 at 9:06 PM, Milind Gupta <mil...@gm...>
>>> wrote:
>>>
>>>> I want to combine to images so that they appear side by side. I was
>>>> following the combine4-10x15.lua example but encountered this issue.
>>>>
>>>> Thanks,
>>>> Milind
>>>>
>>>>
>>>>
>>>> On Fri, Jul 18, 2014 at 5:01 PM, Antonio Scuri <
>>>> sc...@te...> wrote:
>>>>
>>>>> What do you mean by "merge"?
>>>>>
>>>>> Scuri
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Jul 18, 2014 at 8:59 PM, Milind Gupta <mil...@gm...>
>>>>> wrote:
>>>>>
>>>>>> Actually I want to merge it with a jpg image I loaded with im.ImageCreate(r_w,
>>>>>> r_h, im.RGB, im.BYTE)
>>>>>>
>>>>>> How can I achieve that?
>>>>>>
>>>>>> Thanks,
>>>>>> Milind
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Fri, Jul 18, 2014 at 4:54 PM, Antonio Scuri <
>>>>>> sc...@te...> wrote:
>>>>>>
>>>>>>> The image in the GIF file is not an RGB image. So it loaded a
>>>>>>> im.MAP image. That's why the resize failed.
>>>>>>>
>>>>>>> So there are a few ways to make it work.
>>>>>>>
>>>>>>> -- assume the image is map
>>>>>>> r_img = im.ImageCreate(r_w, r_h, im.MAP, im.BYTE)
>>>>>>>
>>>>>>> -- create a new image based on the old one
>>>>>>> r_img = im.ImageCreateBased(image, r_w, r_h, nil, nil)
>>>>>>>
>>>>>>> -- let the ResizeNew do it all
>>>>>>> r_img = im.ProcessResizeNew(image, r_w, r_h, order)
>>>>>>>
>>>>>>> But it would be better to user the write interpolation order.
>>>>>>> im.MAP images can not be linear interpolated.
>>>>>>>
>>>>>>> order = 1
>>>>>>> if (image:ColorSpace() == im.MAP or image:ColorSpace() ==
>>>>>>> im.BINARY) then
>>>>>>> order = 0
>>>>>>> end
>>>>>>>
>>>>>>>
>>>>>>> Best,
>>>>>>> Scuri
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Jul 18, 2014 at 2:47 PM, Milind Gupta <
>>>>>>> mil...@gm...> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>> I am loading a gif file using image =
>>>>>>>> im.FileImageLoadBitmap(fileName) then I want to resize this loaded file so
>>>>>>>> I tried:
>>>>>>>> r_img = im.ImageCreate(r_w, r_h, im.RGB, im.BYTE)
>>>>>>>> im.ProcessResize(image, r_img, 1) -- do bilinear interpolation
>>>>>>>>
>>>>>>>> But I get this error:
>>>>>>>> images must have the same data type and color space
>>>>>>>> stack traceback:
>>>>>>>> [C]: in function 'ProcessResize'
>>>>>>>> bingo.lua:50: in function 'resizeImage'
>>>>>>>> bingo.lua:81: in function 'SavePalettes'
>>>>>>>> bingo.lua:103: in main chunk
>>>>>>>> [C]: ?
>>>>>>>>
>>>>>>>> How can I do the appropriate conversion so that the resize works.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Milind
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------------
>>>>>>>> Want fast and easy access to all the code in your enterprise? Index
>>>>>>>> and
>>>>>>>> search up to 200,000 lines of code with a free copy of Black Duck
>>>>>>>> Code Sight - the same software that powers the world's largest code
>>>>>>>> search on Ohloh, the Black Duck Open Hub! Try it now.
>>>>>>>> http://p.sf.net/sfu/bds
>>>>>>>> _______________________________________________
>>>>>>>> Imtoolkit-users mailing list
>>>>>>>> Imt...@li...
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/imtoolkit-users
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ------------------------------------------------------------------------------
>>>>>>> Want fast and easy access to all the code in your enterprise? Index
>>>>>>> and
>>>>>>> search up to 200,000 lines of code with a free copy of Black Duck
>>>>>>> Code Sight - the same software that powers the world's largest code
>>>>>>> search on Ohloh, the Black Duck Open Hub! Try it now.
>>>>>>> http://p.sf.net/sfu/bds
>>>>>>> _______________________________________________
>>>>>>> Imtoolkit-users mailing list
>>>>>>> Imt...@li...
>>>>>>> https://lists.sourceforge.net/lists/listinfo/imtoolkit-users
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ------------------------------------------------------------------------------
>>>>>> Want fast and easy access to all the code in your enterprise? Index
>>>>>> and
>>>>>> search up to 200,000 lines of code with a free copy of Black Duck
>>>>>> Code Sight - the same software that powers the world's largest code
>>>>>> search on Ohloh, the Black Duck Open Hub! Try it now.
>>>>>> http://p.sf.net/sfu/bds
>>>>>> _______________________________________________
>>>>>> Imtoolkit-users mailing list
>>>>>> Imt...@li...
>>>>>> https://lists.sourceforge.net/lists/listinfo/imtoolkit-users
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Want fast and easy access to all the code in your enterprise? Index and
>>>>> search up to 200,000 lines of code with a free copy of Black Duck
>>>>> Code Sight - the same software that powers the world's largest code
>>>>> search on Ohloh, the Black Duck Open Hub! Try it now.
>>>>> http://p.sf.net/sfu/bds
>>>>> _______________________________________________
>>>>> Imtoolkit-users mailing list
>>>>> Imt...@li...
>>>>> https://lists.sourceforge.net/lists/listinfo/imtoolkit-users
>>>>>
>>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Want fast and easy access to all the code in your enterprise? Index and
>>>> search up to 200,000 lines of code with a free copy of Black Duck
>>>> Code Sight - the same software that powers the world's largest code
>>>> search on Ohloh, the Black Duck Open Hub! Try it now.
>>>> http://p.sf.net/sfu/bds
>>>> _______________________________________________
>>>> Imtoolkit-users mailing list
>>>> Imt...@li...
>>>> https://lists.sourceforge.net/lists/listinfo/imtoolkit-users
>>>>
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> Want fast and easy access to all the code in your enterprise? Index and
>>> search up to 200,000 lines of code with a free copy of Black Duck
>>> Code Sight - the same software that powers the world's largest code
>>> search on Ohloh, the Black Duck Open Hub! Try it now.
>>> http://p.sf.net/sfu/bds
>>> _______________________________________________
>>> Imtoolkit-users mailing list
>>> Imt...@li...
>>> https://lists.sourceforge.net/lists/listinfo/imtoolkit-users
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Want fast and easy access to all the code in your enterprise? Index and
>> search up to 200,000 lines of code with a free copy of Black Duck
>> Code Sight - the same software that powers the world's largest code
>> search on Ohloh, the Black Duck Open Hub! Try it now.
>> http://p.sf.net/sfu/bds
>> _______________________________________________
>> Imtoolkit-users mailing list
>> Imt...@li...
>> https://lists.sourceforge.net/lists/listinfo/imtoolkit-users
>>
>>
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Imtoolkit-users mailing list
> Imt...@li...
> https://lists.sourceforge.net/lists/listinfo/imtoolkit-users
>
>
|