npImgs plugin

About this plugin

This plugin contain useful images related actions and can work with up to 23 differents image input formats up to 18 image output formats. For example, you can convert images from any of the supported input formats to any of the supported output formats.

The plugin also contain others images related actions, like for example one that can apply to any supported input image format one or more of up to 40 different image filters. Also have actions to resize images, scale images, put images watermarks and more. All without need any external application or DLLs.

npImgs also allow you to read/write and strip the JPG IPTC data of a JPG image file. And have actions to read/write and strip JPG EXIF data of JPG images files too. For the other hand is possible to find, get and set the EXIF thumbnail image of JPG image files.

Thirparty

This plugin are imposible without the aid of this people:

Thanks a lot!

Plugin actions index

npImgConvert

This action can convert an image file from one of the supported input format to one of supported output format. Just set a source image path and a target image path. Also you can set a result variable name to store the result of the action, in this case True or False.

If the action result is False you can read the [LastError] NeoBook variable, wich contain information about the action error. The image formats are retrieved based on image files extension. Here is the list of supported image formats in this action:

Supported input formats

Supported output formats

↑↑

npImgInputMask

This action provide you the appropiate dialog mask to be used with the native NeoBook open file dialog. In the result variable name the plugin store all supported image types to be used as input with other actions, like npImgConvert.

↑↑

npImgOutputMask

This action provide you the appropiate dialog mask to be used with the native NeoBook save file dialog. In the result variable name the plugin store all supported image types to be used as output with other actions, like npImgConvert.

↑↑

npImgScale

With this action you can resize an image using width and height percentages of the source image. In other words, you can scale an image by width and height percentages. The output image path can be the same that source image path. In this case the action overwrite the source image. Note that you can also save the source image (after scaling) in other format, like with npImgConvert action.

If everything is OK the result variable contain the "True" value, or "False" in other case. In this last case the [LastError] variable contain the error information.

↑↑

npImgGetSize

With this action you can find the width and height of a image in pixels. Just provide an image path and the action store in the width and height variables the size of the image.

If everything is OK the result variable contain the "True" value, or "False" in other case. In this last case the [LastError] variable contain the error information.

↑↑

npImgSetSize

With this action you can resize an image. In other words, you can set the width and height (in pixels) of an image. The output image path can be the same that source image path. In this case the action overwrite the source image. Note that you can also save the source image (after resizing) in other format, like with npImgConvert action.

Note this action allow you to calculate the image width or height in order to maintain the image aspect ratio. Just set the image width to "-1" if you want to calculate the width based on the height value. And if you want to calculate the image height, set this to "-1" and the plugin calculate the appropiate height value based on the width value.

If everything is OK the result variable contain the "True" value, or "False" in other case. In this last case the [LastError] variable contain the error information.

↑↑

npImgFiltersList

This action allow you to present to the user a list of available image filters supported by the plugin, that you can use later with the npImgApplyFilters. The Filters variable contain an Array with all available image filters names, and the Filters count variable contain the number of filters and items in the Filters variable.

↑↑

npImgApplyFilters

With this action you can apply one or more of the available image filters. All supported input and output image formats by the plugin can be used in this action. The filters names must be comma separated, and are apply in the same order. So, if you pass this filters to the action "Average, Blur, Average", first the "Average" filter is applied, then "Blur" filter is applied, and finally "Average" filter is apply again.

The result variable store "True" if everything is OK, or "False" in other case. In this last case you can find more information about the error in the [LastError] variable.

Currently available image filters:

  1. Average
  2. Average More
  3. Blur
  4. Blur More
  5. Gaussian Blur
  6. Low Pass
  7. Smooth
  8. Smooth Circle
  9. Smooth Cone
  10. Smooth Pyramidal
  11. Sharpen
  12. Sharpen More
  13. Unsharp Mask
  14. High Pass
  15. Laplacian
  16. Edge
  17. Prewitt North South
  18. Prewitt South North
  19. Prewitt East West
  20. Prewitt West East
  21. Prewitt Edge
  22. Sobel North South
  23. Sobel South North
  24. Sobel East West
  25. Sobel West East
  26. Sobel Edge
  27. Line Mask Vertical
  28. Line Mask Horizontal
  29. Line Mask
  30. Emboss
  31. Emboss Color
  32. Mosaic
  33. Minimum
  34. Maximum
  35. Max Min
  36. Min Max
  37. Median
  38. Degrain Bright
  39. Degrain Dark
  40. Degrain

↑↑

npImgGetJpgIptc

This action retrieve the available (and supported by the plugin) JPG IPTC data from a JPG file. When you call to this action, lots of NeoBook variables can be set with the available IPTC data. The action result variable store "True" if everything is OK, or "False" if not. In this last case the [LastError] variable can contain information about the possible error.

Below you can see all supported and possibly IPTC data variables and possible value types. For information about every IPTC variable data I remite you to the IPTC specification.

I recommend you to use the "prefix" variable feature, so you can access to the variables in this form: [Prefix.Destination] and avoid with other possible publication variables collisions.

↑↑

npImgSetJpgIptc

This action set some of the supported JPG IPTC information in a JPG image file. You not need to set all supported variables, only what you want. The others are ignored. You must to procced in this way, just like when set another normal NeoBook variables:

.Set the variables that you want to save

SetVar "Prefix.Destination" "My destination data"

SetVar "Prefix.ServiceIdentifier" "My service identifier data"

.And then save the information in the JPG file

npImgSetJpgIptc "My.jpg" "Prefix" "[Result]"

This action result variable store "True" if everything is OK, or "False" if not. See [LastError] variable for details about possible errors.

Below you can see the supported IPTC information variables and possible values that can be set before call to this action in order to be saved in the JPG file:

Note: As you can see is possible to retrieve more IPTC variables that than can be set: this is because some variables are "read only" and cannot be set, only retrived if exists.

↑↑

npImgStripJpgIptc

This action strip all JPG IPTC information stored in a JPG image file. Every supported tag is deleted from the file, of course if previosly exists. This action result variable store "True" if everything is OK, or "False" if not. See [LastError] variable for details about possible errors.

↑↑

npImgClearJpgIptc

This action clear all JPG IPTC NeoBook related variables. This action not clear the information from a JPG file, just clear the variables (prefixed or not) that you can know by the other plugin JPG IPTC actions.

↑↑

npImgGetJpgExif

This action retrieve the available (and supported by the plugin) JPG EXIF data from a JPG file. When you call to this action, lots of NeoBook variables can be set with the available EXIF data. The action result variable store "True" if everything is OK, or "False" if not. In this last case the [LastError] variable can contain information about the possible error.

Below you can see all supported and possibly IPTC data variables and possible value types. For information about every EXIF variable data I remite you to the EXIF specification.

I recommend you to use the "prefix" variable feature, so you can access to the variables in this form: [Prefix.ImageDescription] and avoid with other possible publication variables collisions.

↑↑

npImgSetJpgExif

This action set some of the supported JPG EXIF information in a JPG image file. You not need to set all supported variables, only what you want. The others are ignored. You must to procced in this way, just like when set another normal NeoBook variables:

.Set the variables that you want to save

SetVar "Prefix.Author" "My name here"

SetVar "Prefix.ImageDescription" "A wonderfull image of my bicycle"

.And then save the information in the JPG file

npImgSetJpgExif "My.jpg" "Prefix" "[Result]"

This action result variable store "True" if everything is OK, or "False" if not. See [LastError] variable for details about possible errors.

Below you can see the supported EXIF information variables and possible values that can be set before call to this action in order to be saved in the JPG file:

Note: As you can see is possible to retrieve more EXIF variables that than can be set: this is because some variables are "read only" and cannot be set, only retrived if exists.

↑↑

npImgStripJpgExif

This action strip all JPG EXIF information stored in a JPG image file. Every supported tag is deleted from the file, of course if previosly exists. This action result variable store "True" if everything is OK, or "False" if not. See [LastError] variable for details about possible errors.

↑↑

npImgClearJpgExif

This action clear all JPG EXIF NeoBook related variables. This action not clear the information from a JPG file, just clear the variables (prefixed or not) that you can know by the other plugin JPG EXIF actions.

↑↑

npImgGetJpgExifThumbnail

Get the thumbnail (if exists) of image of a JPG file. This action store the thumbnail image in the specified path. This action result variable store "True" if everything is OK, or "False" if not. See [LastError] variable for details about possible errors. See also npImgJpgExifHasThumbnail.

↑↑

npImgSetJpgExifThumbnail

Set a JPG image file as the thumbnail of another JPG file. This action result variable store "True" if everything is OK, or "False" if not. See [LastError] variable for details about possible errors.

↑↑

npImgJpgExifHasThumbnail

This action find if a JPG file contain a thumbnail into their EXIF data. The result variable store "True" if a thumbnail exists, or "False" if not. See [LastError] variable for details about possible errors too.

↑↑

npImgCrop

This action can crop the specified input image at the specified x, y, width and height pixels and then save the result to the specified image output. This action support all the input and output images formats supported by the plugin. The result variable return "True" if everything is OK, or "False" when not. See [LastError] variable in this last case for details.

↑↑

npImgFlip

This action flip the image specified for image input and then save the result to the specified image output. This action support all the input and output images formats supported by the plugin. The result variable return "True" if everything is OK, or "False" when not. See [LastError] variable in this last case for details.

↑↑

npImgRotate

This action can rotate the specified input image with the specified angle, and then save the result to the specified image output. The result variable return "True" if everything is OK, or "False" when not. See [LastError] variable in this last case for details.

↑↑

npImgWatermark

With this action you can copy an image into another, and, while alpha blend is supported, do it an image with a watermark. All supported input and output image formats by the plugin can be used in this action. You can load as target image (for example) a BMP image, as watermark (for example) a PNG image, and finally save into the format that you want.

You can specify the position of the watermark using X and Y variable values. If you want to calculate the place of the watemark also you can get aid using the npImgGetSize, but take a look at the npImgWatermarkEx action. The result variable return "True" if everything is OK, or "False" when not. See [LastError] variable in this last case for details.

↑↑

npImgWatermarkEx

This action is similar to npImgWatermark (see for details) but with one difference: allow you to choose one of the availables watermark image position, instead of set the target image relative X and Y coordinates. The result variable return "True" if everything is OK, or "False" when not. See [LastError] variable in this last case for details.

The watermark image position can be one of the following values: wpTopLeft, wpTopCenter, wpTopRight, wpRightCenter, wpBottomRight, wpBottomCenter, wpBottomLeft, wpLeftCenter, wpAllCentered.

↑↑

[npImg.JpgCompressionLevel]

This variable can be set in order to define the JPG compression quality, ranges from 1 (ugly/small) to 100 (nice/large). The defalt value is 90. This variable take effect when you use any action which deal with images like the npImgConvert action, so, it's an optional variable which can/must be set before use any of the plugin actions which deal with images.

↑↑

[npImg.PngCompressionLevel]

This variable can be set in order to define the PNG compression quality, ranges from 0 (no compression) to 9 (best compression). The default value is 5. This variable take effect when you use any action which deal with images like the npImgConvert action, so, it's an optional variable which can/must be set before use any of the plugin actions which deal with images.

↑↑

Action errors subroutine

All the NeoPlugins deal with errors in the same way that NeoBook does: when the plugin found an action error the [LastError] variable store information about the error, so you can take care about this variable when execute an action.

But all the NeoPlugins also incorporate an advanced way to deal with possible action errors. You can define a subroutine named OnNeoPluginActionError in order to be executed when some action error are found and you can use this variables inside:

Note that this error handling subroutine are shared for all the NeoPlugins, so you no need to specify a subroutine for every plugin you use in your publication because the same subroutine are recognized and automagically used by every NeoPlugin. Below you can view a sample of this subroutine code:

:OnNeoPluginActionError
  AlertBox "NeoPlugin Error" "Error [LastError] in plugin: [PluginName]"
Return

Also note that the use of this NeoPlugins error handling subroutine is completelly optional. You can continue using the [LastError] variable as usual and even use the both methods at the same time.

↑↑