[Gambas-user] Picture.ToString() ?

BB adamnt42 at gmail.com
Sat Dec 30 02:00:52 CET 2023


On 30/12/23 11:15 am, Bruce Steers wrote:
> 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
>
What is the origin of the picture?

I do a similar thing but I have the path of the picture and just load it 
as a string via

sPicString = File.Load(picPath)

when I originally load the picture.

As you have already seen, the File.Load does load it as a string (as 
.png is just a flat file).

I haven't tried just assigning the picture to a string variable but I 
guess it does not work.

Otherwise I can't see any faster way.

b

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20231230/f415819b/attachment.htm>


More information about the User mailing list