dbaspot
Tags Register FAQ Calendar Search Today's Posts Mark Forums Read

transpose or recompose - shell

This is a discussion on transpose or recompose - shell ; Hi! I have many jpg files (recomposing a much bigger picture) named x,y.jpg 0,0.jpg 1,0.jpg 2,0.jpg 3,0.jpg ... 0,1.jpg 1,1.jpg 2,1.jpg 3,1.jpg ... 0,2.jpg 1,2.jpg 2,2.jpg 3,2.jpg ... .... ... ... ... ... To put them back together, I tought ...


Home > Database Forum > Operating Systems > shell > transpose or recompose

Reply

 

LinkBack Thread Tools Display Modes
  #1  
Old 11-12-2008, 10:25 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default transpose or recompose

Hi!

I have many jpg files (recomposing a much bigger picture) named
x,y.jpg

0,0.jpg 1,0.jpg 2,0.jpg 3,0.jpg ...
0,1.jpg 1,1.jpg 2,1.jpg 3,1.jpg ...
0,2.jpg 1,2.jpg 2,2.jpg 3,2.jpg ...
.... ... ... ... ...

To put them back together, I tought to use a montage in ImageMagick.

The way my files are ordered is: first column first then second column
and so on.

The problem is that ImageMagic order files is the transpose order:
first row first then second column and so on.

If I cannot find a way, maybe a script, that will recompose the bigger
file in the order they are, i need to change the names of the files to
get ImageMagick to recompose the bigger file.

I looked at it and if I could transform the name x,y.jpg into the
number (x+1000y+1).jpg I would get that:

1.jpg 2.jpg 3.jpg 4.jpg ...
1001.jpg 1002.jpg 1003.jpg 1004.jpg ...
2001.jpg 2002.jpg 2003.jpg 2004.jpg ...
3001.jpg 3002.jpg 3003.jpg 3004.jpg ...
.... ... ... ... ...

That would work in ImageMagick.

Would sed or hawk handle that transformation or would I be better to
use a script to recompose the bigger file?

Thank you!
Reply With Quote
  #2  
Old 11-13-2008, 03:56 AM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: transpose or recompose

2008-11-12, 18:25(-08), jesusisresurected:
[...]
> 0,0.jpg 1,0.jpg 2,0.jpg 3,0.jpg ...
> 0,1.jpg 1,1.jpg 2,1.jpg 3,1.jpg ...
> 0,2.jpg 1,2.jpg 2,2.jpg 3,2.jpg ...

[...]
> I looked at it and if I could transform the name x,y.jpg into the
> number (x+1000y+1).jpg I would get that:
>
> 1.jpg 2.jpg 3.jpg 4.jpg ...
> 1001.jpg 1002.jpg 1003.jpg 1004.jpg ...
> 2001.jpg 2002.jpg 2003.jpg 2004.jpg ...
> 3001.jpg 3002.jpg 3003.jpg 3004.jpg ...

[...]

zsh:

autoload -U zmv
zmv -n '(*),(*).jpg' '$(($1+1000*$2+1)).jpg'

remove "-n" to actually do the work when happy.

or:

ls | awk -F '[,.]' '/^[0-9]+,[0-9]+\.jpg$/ {
printf "mv -i %s %d.jpg\n", $0, $1 + 1000 * $2 + 1}'

Add "| sh" when happy.

--
Stéphane
Reply With Quote
  #3  
Old 11-13-2008, 10:18 PM
Database Bot
 
Join Date: Sep 2009
Posts: 1,236,254
Database Administrator is on a distinguished road
Default Re: transpose or recompose


>
> zsh:
>
> autoload -U zmv
> zmv -n '(*),(*).jpg' '$(($1+1000*$2+1)).jpg'
>
> remove "-n" to actually do the work when happy.


I was often impressed by zmv. I am now more. On top of that it works
and I understand!
>
> or:
>
> ls | awk -F '[,.]' '/^[0-9]+,[0-9]+\.jpg$/ {
> * printf "mv -i %s %d.jpg\n", $0, $1 + 1000 * $2 + 1}'
>
> Add "| sh" when happy.


This one, inpire fear. Would you be nice enough to decorticate it?
Also would it apply for more than 10 colunms or more than 10 rows?

Thank you!
>
> --
> Stéphane


Reply With Quote
  #4  
Old 02-23-2010, 02:46 AM
Database Expert
 
Join Date: Feb 2010
Posts: 42
HENARRY JAYA is on a distinguished road
Default Re: transpose or recompose

To transpose from G to E-flat, every note has to be moved down four half-steps, because E-flat is four half-steps lower than G. (G, G-flat, F, E, E-flat.) If the first note of the original song is a D, then it transposes down to a B-flat (D, D-flat, C, B, B-flat).

The key signature for E-flat has three flats (B-flat, E-flat, A-flat).
Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT -4. The time now is 09:48 AM.