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

desktop

Index

Methods

createFromPath

  • createFromPath(filePath: string): Promise<Handle>
  • Creates an image from the provided path. Note that images and PDFs are supported. If you provide a URL instead of a local path, the file will be downloaded first then converted to an image.

    Parameters

    • filePath: string

createFromPdfPath

createFromPdfResource

createFromResource

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

    • resourceId: string

crop

free

  • Image data is not automatically deleted by Joplin so make sure you call this method on the handle once you are done.

    Parameters

getPdfInfoFromPath

  • getPdfInfoFromPath(path: string): Promise<PdfInfo>
  • Parameters

    • path: string

getPdfInfoFromResource

  • getPdfInfoFromResource(resourceId: string): Promise<PdfInfo>
  • Parameters

    • resourceId: string

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