maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Ambience convert from 540x960 jpegs by LInux script (https://talk.maemo.org/showthread.php?t=92679)

Kaacz 2014-02-12 03:57

Ambience convert from 540x960 jpegs by LInux script
 
Hi,

Jolla gallery app create ambience by crop way. This is not good.

I wrote really simple linux shell script for expand standard 540x960 wallpaper jpeg file to Jolla Ambience 540x1600 jpeg by ImageMagick tool "convert". For use on Linux desktop. Jolla phone have not ImageMagick tools .. :)

Code:

#! /bin/bash

[ -z $1 ] && echo "Run: $0 file_name.jpg" ; exit 2

wpdir=`dirname "$1"`
wpname=`basename "$1"`

convert "${wpdir}/${wpname}" -crop 540x1+0+0 +repage "tmp_first.jpg"
convert "${wpdir}/${wpname}" -crop 540x1+0+959 +repage "tmp_last.jpg"
convert "tmp_first.jpg" -duplicate 115,0 -append -blur 0x8 "tmp_top.jpg"
convert "tmp_last.jpg" -duplicate 261,0 -append -blur 0x8 "tmp_end1.jpg"
convert "tmp_end1.jpg" -fill black -draw 'color 0,0 reset' "tmp_end2.jpg"
convert "tmp_top.jpg" "${wpdir}/${wpname}" "tmp_end1.jpg" "tmp_end2.jpg" -append "ambience_${wpname}"

rm -f tmp_*.jpg

Script simply read "name.jpg" from script parameter, create top blurred expansion from first pixel line, bottom blurred expansion from last line and rest black space, then montage all to one 540x1600 "ambience_name.jpg" file to current directory.

Good with clean first/last lines. :) Right input size 540x960 pixels not checked/fixed!
But on internet are thousand 540x960 pictures/wallpapers. :)

540x960_input_file_example and 540x1600_ambience_output

Any better solutions are welcome.. :)

PS: sorry for my ugly english..

mced 2014-02-12 08:54

Re: Ambience convert from 540x960 jpegs by LInux script
 
It shouldn't be hard to compile under Sailfish, even if it's a "low featured" ImageMagick.

HtheB 2014-02-12 09:04

Re: Ambience convert from 540x960 jpegs by LInux script
 
a simple gui would make wonders for all Sailfish OS users :)

Schturman 2014-02-12 19:02

Re: Ambience convert from 540x960 jpegs by LInux script
 
Quote:

Originally Posted by HtheB (Post 1412356)
a simple gui would make wonders for all Sailfish OS users :)

I will try.. Like before via terminal...

PS. how to run your script ?

PS2. from where you installed imagemagick package ?

Kaacz 2014-03-03 19:23

Re: Ambience convert from 540x960 jpegs by LInux script
 
Quote:

Originally Posted by Schturman (Post 1412473)
PS. how to run your script ?

Write jpeg file as parameter, only one file.
For batch-run two ways is possible
1) "envelope" to cycle with find "*.jpg"
2) call from other script with find and using xargs - my way on MPU desktop .. :)

Quote:

PS2. from where you installed imagemagick package ?
I use it on desktop PC.
But for SailfishOS - Done by NielDK in OpenRepos. :)

Schturman 2014-03-03 21:30

Re: Ambience convert from 540x960 jpegs by LInux script
 
Quote:

Originally Posted by Kaacz (Post 1415292)
Write jpeg file as parameter, only one file.
For batch-run two ways is possible
1) "envelope" to cycle with find "*.jpg"
2) call from other script with find and using xargs - my way on MPU desktop .. :)
I use it on desktop PC.
But for SailfishOS - Done by NielDK in OpenRepos. :)

Thanks, I will play with it :)


All times are GMT. The time now is 15:16.

vBulletin® Version 3.8.8