Options
All
  • Public
  • Public/Protected
  • All
Menu

joplin.imaging

Provides imaging functions to resize or process images. You create an image using one of the createFrom functions, then use the other functions to process the image.

Images are associated with a handle which is what will be available to the plugin. Once you are done with an image, free it using the free() function.

View the example

Index

Methods

createFromPath

  • createFromPath(filePath: string): Promise<Handle>
  • Parameters

    • filePath: string

createFromResource

  • createFromResource(resourceId: string): Promise<Handle>
  • Parameters

    • resourceId: string

crop

free

  • free(handle: Handle): Promise<void>
  • Image data is not automatically deleted by Joplin so make sure you call this method on the handle once you are done.

    Parameters

getSize

  • getSize(handle: Handle): Promise<any>

resize

toJpgFile

  • toJpgFile(handle: Handle, filePath: string, quality?: number): Promise<void>
  • Quality is between 0 and 100

    Parameters

    • handle: Handle
    • filePath: string
    • Default value quality: number = 80

toJpgResource

  • toJpgResource(handle: Handle, resourceProps: any, quality?: number): Promise<ResourceEntity>
  • Creates a new Joplin resource from the image data. The image will be first converted to a JPEG.

    Parameters

    • handle: Handle
    • resourceProps: any
    • Default value quality: number = 80

toPngFile

  • toPngFile(handle: Handle, filePath: string): Promise<void>
  • Parameters

    • handle: Handle
    • filePath: string

toPngResource

  • toPngResource(handle: Handle, resourceProps: any): Promise<ResourceEntity>
  • Creates a new Joplin resource from the image data. The image will be first converted to a PNG.

    Parameters

    • handle: Handle
    • resourceProps: any