Stable Diffusion Commands

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > AI - Artificial Intelligence Commands > SD - Stable Diffusion AI > SDL. - Stable Diffusion Local System >

Stable Diffusion Commands

SDL.Get Image

Previous Top Next


MiniRobotLanguage (MRL)

 

SDL.Get Image

Return Image data from JSON string

 

Sampler_0033_Steps_140_SetSteps

Image generated with SDL. - Command.

 

Intention

 

The SDL.Get Image command is used to get the Base64 encoded Image Data that was returned from the Server, and has been extracted using the "SDL.Analyze" Command.

 
Generally you do not need this command normally, as this is all done transparently using the SDL.Generate Picture to File Command.

This Command is therefore for special usage, for example if you want to use the Base64-Encoded Pictures to upload them to a Server for "Image to Image".

 
Upon successful analysis of the provided JSON string, using SDL.Analyze,  specific data is extracted and stored into predefined variables:

AIO_Choices: Contains the number of choices/images present in the JSON.

AIO_Images(): An array storing the images retrieved from the JSON. The size of this array is determined by AIO_Choices.

InfoString: Contains the "info" value extracted from the JSON.

 

You can read these Variables as follows:

 

' Get AIO_Choices
AIC.Get Several|6|$$ANZ

' Get InfoString
AIC.Get Several|7|$$RET

' P1 - Nr. of Image 0.based, $$RET Variable that 
' will contain the Image Data in Base64-Format, needs to be decoded 

FOR.$$LOP|0|($$ANZ-1)

  SDL.Get Image|$$LOP|$$RET
  AIC.decode from Base64|$$RET|$$PIC

  ' Picture is now in $$PIC ready to be saved as "PNG"-File. 

  SDL.Copy Var to File|$$PIC|Image_?.png

NEX.

 

Error Handling

The command may return an Error-Message instead of the picture data, in case of errors.

 

Examples

Analyze a JSON string and don't save the result:

 
SDL.Analyze|$$JSO|$$RET

SDL.Get Image|0|$$RET
AIC.decode from Base64|$$RET|$$PIC

' Picture is now in $$PIC ready to be saved as "PNG"-File. 

SDL.Copy Var to File|$$PIC|Image_?.png

 

 

 

Syntax

 

 

SDL.Get Image[|P1][|P2]

SDL.Gim[|P1][|P2]

 

 

Parameter Explanation

 

P1 - (optional) Is the Picture Number, 0-based. If omitted Picture 0 is taken.

P2 - (optional) Is the Variable that will receive the Base64-Encoded Picture data as it was send by the Server.
                                    You need to decode it before you can save it as a ".png"-File.

 

 

 

 

Example

 

'***********************************

'

'***********************************

 

 

 

 

 

Remarks

 

-

 

 

Limitations:

 

-

 

 

See also: