• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

1stplugins

FileMaker plug-ins and Reverse Engineering

  • Plugins
    • MediaManager
  • Services
    • Reverse Engineering
    • FileMaker Plug-Ins
  • About
    • About Us
    • Contact Us
    • Terms of Use of the Website and Privacy Policy
  • Store
    • Terms and Conditions
    • Warranty Claim Guidelines
    • Contract Withdrawal Form
    • Warranty Claim Report

Media_ConvertImage

Media_ConvertImage ( container ; type { ; depth ; hres ; vres ; targetBytes ; quality ; imageIndex; transcode ; packBits ; interlace } )

Media_ConvertImage converts an image to the specified type, resolution, image depth, and image quality.

Parameter Description
container The location of the source image.
The container parameter can be:

  • a container field
  • file path
  • text field with a file path
  • image URL
  • a function or calculation that results in an image
type The image type to convert the image to (JPEG, TIFF, etc.).
depth The bit depth of the converted image.
hres The horizontal resolution in pixels/inch. You must specify either both hres and vres or neither.
vres The vertical resolution in pixels/inch. You must specify either both hres and vres or neither.
targetBytes The size in bytes that the converted image should not exceed. Image quality is reduced as needed so this target is met. (Must be set to “-1” to set the quality parameter that follows.).
quality The image quality level.

  • 0 = Minimum Quality, Maximum Compression
  • 256 = Low Quality, High Compression
  • 512 = Normal Quality, Medium Compression
  • 768 = High Quality, Low Compression
  • 1023 = Maximum Quality, Minimum Compression
  • 1024 = Lossless Quality

Some image types do not implement all of these compression values. ConvertImage will default to the next larger allowable quality. When targetBytes is specified, this parameter is ignored.

imageIndex The number of the image layer from the source image to use for multi-image formats. (Default is 1.) TIFF and PhotoShop images can contain multiple image layers. MM cannot create multi-layer images.
transcode When set to “1”, the conversion is attempted directly from the source image, without first decompressing it. This can save processing time.
packBits (TIFF images only) When set to “1”, TIFF images are compressed using PackBits (lossless). When “0”, TIFF images are not compressed.
interlace (GIF and PNG images only) When set to “1”, GIF and PNG images will be interlaced (progressive display).

With the above parameters, use “-1” to specify the default value for that setting. The default is usually the value from the source image.

Long and Short Parameter Options

You can use this function in either its short form where you specify only container and type, or in its long form with all ten of the above parameters. The short form, Media_ConvertImage( container ; type ) will re-use the same settings last used in the longer form.

Output Type Notes

MediaManager can only convert images to the output types listed by the Media_ListImageOutputTypes function (see below).

For output type, you can also pass a pipe separated list for the type parameter. If you do this, only the first element will be used as the output type. This is a convenience for using Media_ListImageOutputTypes in a popup menu.
You must convert MMIM type images to a standard type before they can be exported. (See the discussion of MMIM format and image output types above.)

Converting Without Changing Image Type

If you want to use Media_ConvertImage to change aspects of an image but not alter the image type, set the Type parameter to empty quotes (""). You can, for example, change image resolution while keeping the image a JPEG, TIFF, etc.

Converting Images in Demo Mode

When you convert an image with an unregistered copy of MediaManager, the resulting image will be marked with a white circle. This behavior disappears when you register MediaManager.

Parameters for Specific Image Types

The targetBytes, quality, transcode, packBits, and interlace do not apply to every image output type. They will be ignored when they do not apply to a particular conversion operation.

Returns

The converted image of the specified type.

Examples

To convert an image held in a container field named “Image 1” to JPEG format and place the result into a container field named “Image Converted”:

Set Field [ MyTable::Image Converted;
Media_ConvertImage (
MyTable::Image 1 ;
"JPEG" ) ]

To convert an image using a hardcoded filepath and name to PNG format:

Set Field [ MyTable::Image Converted;
Media_ConvertImage (
".A/image examples/logo.gif" ;
"PNGf" ) ]

To convert an image using a text field that holds the filepath and name to TIFF format:

Set Field [ MyTable::Image Converted;
Media_ConvertImage (
".A/image examples/logo.gif" ;
"TIFF" ) ]

To convert an image to JPEG with a resolution of 72 pixels per inch:

Set Field [ MyTable::Image Converted;
Media_ConvertImage (
MyTable::Image 1 ;
"JPEG" ;# type
"" ;# default depth
72 ; 72 ;# hres, vres
-1 ;# default targetBytes
"" ;# default image index
"" ;# default transcodex
"" ) ]# default interlacing

Primary Sidebar

Document Functions

Media_CopyItem
Media_CreateAlias
Media_CreateFolder
Media_DeleteItem
Media_ExportField
Media_ExtractInfo
Media_GetDefaultFolder
Media_GetItemInfo
Media_GetName
Media_GetPath
Media_InsertFile
Media_ListDisks
Media_ListFolder
Media_MoveItem
Media_OpenItem
Media_RenameItem
Media_Search
Media_SetDefaultFolder

General and Registration Functions

Media_Get
Media_GetLastError
Media_GetMouseUp
Media_JSONPath
Media_PeekStream
Media_Register
Media_RegisterLicensedEncoder
Media_Set
Media_Version

Image Functions

Media_ConvertImage
Media_CreateQRCode
Media_EffectApply
Media_EffectDialog
Media_GetImageInfo
Media_GetMetadata
Media_InsertImage
Media_ListImageOutputTypes
Media_SetImageDefaults Media_TApply
Media_TClear
Media_TCrop
Media_TQuad
Media_TResize
Media_TRotate
Media_TScale
Media_TSkew

Script Steps

Copy Item
Create Alias
Create Folder
Delete Item
Export Field
Get Default Folder
Get Item Property
Move Item
Open Item
Rename Item
Set Default Folder

Sound Functions

Media_Amplify
Media_AppendSound
Media_ConvertSound
Media_CreateSound
Media_DrawWaveform
Media_ExtractSound
Media_FadeSound
Media_GetMetadata
Media_GetSoundInfo
Media_InsertQuickTime
Media_ListSoundOutputFormats
Media_MixSounds
Media_Normalize
Media_PlayPause
Media_PlaySound
Media_RecordSoundFormatDialog
Media_RecordSoundStart
Media_RecordSoundPause
Media_RecordSoundStop
Media_SetMetadata
Media_SoundFormatDialog
Media_StopSound

Video Functions

Media_GetVideoInfo

Footer

Let’s get started on your project.

Get in touch

  • Plugins
  • Services
  • About
  • Store

Copyright ©2006-2020 by 1stplugins, s.r.o. All rights reserved.