cancel
Showing results for 
Search instead for 
Did you mean: 

processing of Image files in PI

Former Member
0 Kudos

Hi experts,

I have a requirement where an input excel file will have an image name, and all images are in a particular folder.

Is it possible to go to that folder and verify the properties..such as if image is more than 500 pixel, then throw error else continu with the mapping of the rest of the fields in the xl file?

I have searched a lot, I dont think its possible in PI runtime..

would any of u have any suggestions?

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member181962
Active Contributor
0 Kudos

Hi Ravindra,

YOu can write a UDF to get the file size(which is directly proportional to your pixel count.

and raise an exception if it over a threshold value.

http://blog.codebeach.com/2007/05/get-size-of-file-in-java.html

But this approach works if the folder with the images is on XI server in which you are working.

Regards,

Ravi Kanth Talagana

Former Member
0 Kudos

Hi Ravi,

Thanx for ur reply..

the excel file is picked up from a folder, that has an image nam ein one column.

Then we have to go to that folder in PI runtime and see the pixel...

i got ur idea..but im struck on how i can do it in PI..

cos its one instance when a file gets picked, xl file so adapter module to read it...

then one field is image name...then how can i go to image size placed in anothe rfolder..

kindly help me out..im lost of ideas

Former Member
0 Kudos

Ravindra,

Go with Java mapping. You can read image file inside java mapping and then you can process the data as per your requirement.

Hope this will help.

Let me know if you need more details.

Thanks,

Nilesh

Former Member
0 Kudos

Hi,

To read the excel file content use: POI

http://poi.apache.org/trans/es/index.html

To handle images use: java.awt.image standard library

http://www.java2s.com/Code/Java/2D-Graphics-GUI/Imagesize.htm

Regards

Ivá

Former Member
0 Kudos

Hi Guys,

I really appreciate ur ideas but im still lost.

let me explain the requirement in detail so u can suggest ne ideas...

/usr/datafile/file.xls

col1 col2 col3

data data2 imagename

adapter module sender adapter to pick the file and transform it in xml...

/usr/datafile/images/imagename

this folder has images in it...

this image size is what i ahve to find out and process file.xls only if imagename is leaa than 500 pixel...

any ideas?

Former Member
0 Kudos

Ravindra,

This is very simple...

Using module( which you already wrote) you can read Excel data. Now call for java mapping. In java mapping you can read the image file and its property directly from location "usr/datafile/images/imagename". You do not need to send this data using module.

Look at the blog provided by jose...

http://www.java2s.com/Code/Java/2D-Graphics-GUI/Imagesize.htm

String url = "http://www.java2s.com/style/logo.png"; replace with "usr/datafile/images/imagename.jpg";

For java mapping look check out this reference..... ( You can find n number of blogs on java mapping )

https://wiki.sdn.sap.com/wiki/display/Snippets/FILEtoIDOCusingJava+Mapping

Hope this will help.

Thanks,

Nilesh

Former Member
0 Kudos

Hi Nilesh,

Thanks for the idea...will definately try..

i need one more help..this is being carried out not on XI server as i mentioned. /usr/sap..

its on an external system but wthin the landscape...

and ther er multipple such images as the number of col sn excel....

would it work?

Former Member
0 Kudos

Hi,

It both server are in the same network, It should not be a problem.

You can try with:
externalsystem\directory\image1.png

Regards

Ivan

Former Member
0 Kudos

When you said same landscape, I belive you mean to say on same n/w. If so then as mentioned by Jose you can map the n/w drive and read.

Hope this will help.

Thanks,

Nilesh

smavachee
Active Contributor
0 Kudos

Hi Ravindra,

We have almost similar scenario. Can you guide me through the same.?

Excel file with image name in its columns.

Thanks in advance.

Sunil M