Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] change picture size

I've got a scenario like this:
First scan a list of files specifically all pictures(files with .jpg or jpeg) inside one folder;
then get the size of of the picture;
if the size is greater than a certain size make it smaller; if it's already smaller than that size just continue the process;
I'd like to ask if there's a way to re-size the picture. How to design this process? Could anyone give me some idea?
Thanks!
Labels (2)
24 Replies
Anonymous
Not applicable
Author

Yes you have to install it, just go on the website and depending on your OS choose the right installer. Then for your job:

tFileList------tSystem
of cours you put the right directory inyour tFileList, and then for you tSystem:
"cd the_path_where_you_have_installed_imagemagick(for me C:\ImageMagick-6.7.3-Q16)" //carefull with "\", depending on the OS where the job is running
"convert "+((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))+" -resize 64x64\! "+((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY"))+"\exact_"+((String)globalMap.get("tFileList_1_CURRENT_FILE"))+"."+((String)globalMap.get("tFileList_1_CURRENT_FILEEXTENSION"))
It should create the converted images with the prefix "exact" in your folder. Let me now if it works. ps:I didn't check the convert method of imagmagick, i've used yours

Perhaps there's something wrong with the command "convert "+((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))+" -resize 64x64\! "+((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY"))+"\exact_"+((String)globalMap.get("tFileList_1_CURRENT_FILE"))+"."+((String)globalMap.get("tFileList_1_CURRENT_FILEEXTENSION"))
The job can be executed but with following error message.
connecting to socket on port 3477
connected
Invalid Parameter - -resize
disconnected

I wonder if some of the quotes are necessary or right. THANKS!!!
Anonymous
Not applicable
Author

Remove the "\" before the "!".
Anonymous
Not applicable
Author

It's still not right. This even returned more error and couldn't be executed at all.
I forgot to mention I've already changed the expression as follows. And that "Invalid" message was coming from this expression, not the one you corrected.
"convert "+((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))+" -resize 64x64 "+((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY"))+((String)globalMap.get("tFileList_1_CURRENT_FILE"))+"."+((String)globalMap.get("tFileList_1_CURRENT_FILEEXTENSION"))

Do you have any clue? I've been keeping trying.
Thanks.
Anonymous
Not applicable
Author

What do you exactly put in your tSystem?
Anonymous
Not applicable
Author

shown in pic and the expression is

"convert "+((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))+" -resize 64x64 "+((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY"))+((String)globalMap.get("tFileList_1_CURRENT_FILE"))+"."+((String)globalMap.get("tFileList_1_CURRENT_FILEEXTENSION"))
Anonymous
Not applicable
Author

try
"convert "+((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))+" -resize 64x64 "+((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY"))+"\"+((String)globalMap.get("tFileList_1_CURRENT_FILE"))+"."+((String)globalMap.get("tFileList_1_CURRENT_FILEEXTENSION"))
Anonymous
Not applicable
Author

Really sorry to bother again...It's weird. Still not working. Got the error message as the first pic. I've tried many different ones.
Another pic is the one I also tried. I made the file the same name. Then still got "Invalid Parameter - -resize". Is there anything wrong with the ImageMagick command?
Thanks!
Anonymous
Not applicable
Author

do you get smthing when you put "convert help" in the tsystem?
Anonymous
Not applicable
Author

Do you mean to put only "convert help" in the command line? I tried and got "Invalid drive specification." So does this mean that I didn't make the ImageMagick working right? I have to make some changes to home directory?
Also I tried to changed the "to console" to normal in the standard output as shown in the picture. Then it executed without any error. The problem is that I didn't see any change to my file.
I put the command like "convert"+((String)globalMap.get("tFileList_1_CURRENT_FILEPATH"))+" -resize 64x64 "+((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")). I think it will rename as the same name (cover the original one). But nothing has changed.
Thank you!!!
Anonymous
Not applicable
Author

I finally find the solution (took a long time, ImageMagick is quite strange). It seems that in order to use ImageMagick you have to use the .exe and not use it like a .bat file. So the solution:
In your home directory: "C:\\Program Files\\ImageMagick-6.7.3-Q16"
in your tsystem, copy EXACTLY this:
"C:\\Program Files\\ImageMagick-6.7.3-Q16\\convert.exe "+((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")) +" -resize 64x64 "+((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY"))+"\\exact_"+((String)globalMap.get("tFileList_1_CURRENT_FILE"))+"."+((String)globalMap.get("tFileList_1_CURRENT_FILEEXTENSION"))
The copy of your images will be generated in the same folder of the previous images, if you want to generate them in an other folder, replace ((String)globalMap.get("tFileList_1_CURRENT_FILEDIRECTORY")) by an other directory path
The copy fo your images will have the prefix exact, of course it's up to you to change it.
Please tell me if you have achieved it. I've made the job, it works fine.

PS: don't forget that you have to put "\\" instead of "\" when you directly write a path