[Gambas-user] Picture.ToString() ?
Gianluigi
gradobag at gradobag.it
Sat Dec 30 18:46:24 CET 2023
HI,
sorry, I'm back now and I gave it a quick read, I didn't understand why
you can't use File.Load()
Regards
Gianluigi
Il 30/12/23 16:02, Claus Dietrich ha scritto:
> Sorry, I just found a number of posts as spam at my email provider -
> incl. the image-data solution of Vuott:
>
> Public Sub PictureToString(Pic As Picture) As String
>
> Dim s As String
>
> For i As Integer = 0 To (pic.Image.Pixels.Max * (pic.Depth / 8))
> s &= MkByte(Byte@(pic.Image.Data + i))
> Next
>
> Return s
>
> End
>
> I get the error "wrong argument" (@ i=0) in the line
>
> s &= MkByte(Byte@(pic.Image.Data + i))
>
> With a PictureToString-function I just would like achieve the same as
> with
>
> Dim sTmp As String = File.SetExt(Temp("tmp-pic"), "jpg")
> Pic.Save(sTmp)
> Return File.Load(sTmp)
>
> This means that I would have to pass the bitmap format (jpg, png, pnm)
> and possibly the depth.
>
> Regards
>
> Claus
>
> Am 30.12.23 um 15:21 schrieb Claus Dietrich:
>> Hi
>>
>> Why don't we have this function? I would have needed it many times
>> already and someone else recently asked me for that.
>>
>> Could the Data-property of the image class help to get a fast
>> solution? If so, how can it be used?
>>
>> Regards
>>
>> Claus
>>
>>
>>> If there any simpler (non-file) way to get the opposite of
>>> Picture.FromString()
>>> I wanted a way to transmit image data using Print in Task.class.
>>>
>>> This works for me but wondered if there was a faster way than a
>>> physical
>>> file?
>>>
>>> Public Sub PictureToString(Pic As Picture) As String
>>>
>>> Dim sTmp As String = File.SetExt(Temp("tmp-pic"), "png")
>>> Pic.Save(sTmp)
>>> Return File.Load(sTmp)
>>>
>>> End
>>>
>>> Respects
>>> BruceS
>>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
More information about the User
mailing list