Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on
12-12-2019
10:18 PM
- last edited on
12-13-2019
02:22 AM
by
VidyaSargur
Hi,
I am extracting image width and image height using ExtractImageMetadata processor and comparing the Image Width and Image Height with threshold value. If it is greater than the threshold value than I will resize the image. Attribute names, Image Width and Image Height is different for different image formats.
e.g. For .png
PNG-IHDR.Image Height
PNG-IHDR.Image Width
For .jpg
JPEG.Image Height
JPEG.Image Width
I want to have a regular expression something like below. So that irrespective of image format, I will be able to compare the Image Width and Image Height.
${"*Image Width":ge(1000):and(${"*Image Height":ge(1000)})}
Above regular expression is not working as expected. Any input will be helpful.
Thanks and Regards,
Biswa
Created 12-13-2019 06:37 AM
NiFi's Expression Language (EL) will not support wildcard in attribute subject names.
I suggest you pull height and width in to a set of standardized attribute names:
Use the UpdateAttribute processor advanced UI to create some rules. Fore example:
if "PNG-IHDR.Image Height" attribute exists, create new attribute "image height" with value from "PNG-IHDR.Image Height"
Do the same for the other 3 unique attribute names, thus resulting in a static attribute subject names for height and width for use later in your flow for comparison/routing decisions.
Hope this helps,
Matt
Created 12-13-2019 06:37 AM
NiFi's Expression Language (EL) will not support wildcard in attribute subject names.
I suggest you pull height and width in to a set of standardized attribute names:
Use the UpdateAttribute processor advanced UI to create some rules. Fore example:
if "PNG-IHDR.Image Height" attribute exists, create new attribute "image height" with value from "PNG-IHDR.Image Height"
Do the same for the other 3 unique attribute names, thus resulting in a static attribute subject names for height and width for use later in your flow for comparison/routing decisions.
Hope this helps,
Matt
Created 05-31-2021 06:12 PM
@MattWho
would it be possible to share this configuration inside the advanced UI?
I'm having the same problem and I haven't found any way to check if the "Image Height" exists.
Not even a way to get the value.
Created 05-31-2021 08:13 PM
I managed to solve the problem.
Below is an example of what I used to get the value of the attributes using the advanced part of the "UpdateAttribute".
Hope this helps.