Re: externalize-image
I was able to get this to work, but then I got a new set of images
from the client and it doesn't work with them. I've attached a
sample image file. I may be misunderstanding something about
gp:load-image. How can I load an image that works with
make-image-access?
CL-USER 7 > (setq b (capi:contain (make-instance 'capi:output-pane)))
#<CAPI:OUTPUT-PANE 200E1B87>
CL-USER 8 > (setq im (gp:load-image b "around_small.png" :editable :with-alpha))
#<GRAPHICS-PORTS:IMAGE 200FC0D3>
CL-USER 9 > (gp:make-image-access b im)
Error: MAKE-IMAGE-ACCESS called on a non-editable image :
#<GRAPHICS-PORTS:IMAGE 200FC0D3>
On Tue, Aug 24, 2010 at 11:41 AM, Gail Zacharias <gz@clozure.com> wrote:
> On Tue, Aug 24, 2010 at 11:38 AM, Martin Simmons <martin@lispworks.com> wrote:
>>>>>>> On Tue, 24 Aug 2010 11:21:16 -0400, Gail Zacharias said:
>>>
>>> On Tue, Aug 24, 2010 at 12:25 AM, Raffael Cavallaro
>>> <raffaelcavallaro@mac.com> wrote:
>>> >
>>> > On Aug 23, 2010, at 10:25 PM, Gail Zacharias wrote:
>>> >
>>> >> But if I call it with a
>>> >> .png file, the second copy gets a black background. What am I doing
>>> >> wrong?
>>> >
>>> > I get funky drawing (i.e., a blank background - did you mean "black" or
>>> > "blank?") even with a jpeg unless I call gp:invalidate-rectangle on the
>>> > pinboard-layout (i.e., b) after the second call to
>>> > capi:manipulate-pinboard, though this may not be the underlying issue..
>>>
>>> I meant black, at least that's what happens with the images I have.
>>>
>>> It seems to have something to do with transparency. If I set the
>>> pinboard background to green so I can see which bits in the original
>>> image are transparent and which are just white, I notice that the
>>> round trip through externalize-image turns the transparent bits to
>>> black. In my jpg images the background was plain white, and that
>>> worked fine through the round trip.
>>>
>>> So maybe externalize-image doesn't preserve the alpha values? Is
>>> there any way to make it do so?
>>
>> Yes, that's the problem. Externalize-image always generates a bmp file, but
>> there is no standard definition for bmp files with transparency.
>>
>> Can you use the image access APIs (in particular,
>> gp:image-access-pixels-from-bgra, gp:image-access-pixels-to-bgra and
>> gp:make-image) instead of externalize-image?
>
> I'll give it a try. Thanks.
>
>>
>> --
>> Martin Simmons
>> LispWorks Ltd
>> http://www.lispworks.com/
>>
>