Implemented as EncodeImage()
I'd like some commands to save images directly to the memory, for example in JPG format. I always have to save the image to the HD and read it again into the memory, for example when i make a screenshot an send it directly via network. An JPG - compressed it's much faster than send it raw.
[Implemented] SaveImageToMemory()
Thank you.
I found the code and made a Procedure:
I found the code and made a Procedure:
Code: Select all
Procedure SaveImageToMemory(Image, *MemSize, Format = #PB_ImagePlugin_JPEG, Compression = 7)
Protected *Mem, MemSize, ImageDataPipe
MemSize = ImageDepth(Image)*ImageHeight(Image)*ImageWidth(Image)
*Mem = AllocateMemory(MemSize)
ImageDataPipe = CreateNamedPipe_("\\.\pipe\ImageDataPipe", #PIPE_ACCESS_INBOUND | #FILE_FLAG_OVERLAPPED, #PIPE_TYPE_BYTE | #PIPE_READMODE_BYTE | #PIPE_NOWAIT, 1, MemSize, MemSize, #NMPWAIT_USE_DEFAULT_WAIT, #Null)
SaveImage(Image, "\\.\pipe\ImageDataPipe", Format, Compression)
ReadFile_(ImageDataPipe, *Mem, MemSize, *MemSize, #Null)
CloseHandle_(ImageDataPipe)
ProcedureReturn *Mem
EndProcedure