Help: mirroring along a diagonal

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
kolorman
Posts: 19
Joined: 2011-03-19T14:50:16-07:00
Authentication code: 8675308

Re: Help: mirroring along a diagonal

Post by kolorman »

Wow!!!!!!!!!

Thanks for yours extensive information at this forum an per email!!

I just try it in this week...

Thanks! Thanks! Thanks!

kolorman
kolorman
Posts: 19
Joined: 2011-03-19T14:50:16-07:00
Authentication code: 8675308

Re: Help: mirroring along a diagonal

Post by kolorman »

Hi,

I send meanwhile any informations about my projekt - at first: it works!

Thanks at your all

I have any trouble in this time - I send more in the next week!

korlorman
kolorman
Posts: 19
Joined: 2011-03-19T14:50:16-07:00
Authentication code: 8675308

Re: Help: mirroring along a diagonal

Post by kolorman »

fmw42 wrote: convert zelda3.jpg \( +clone -transpose \) \
\( +clone -sparse-color voronoi '%w,0 white 0,%h black' \) \
-composite \
\( +clone -flop -chop 1x0 \) +append \
\( +clone -flip -chop 0x1 \) -append \
zelda3_kaleidoscope.jpg

Image
Hi fmw42,

you "compress" three convert rows to one convert command, but i less the first command

Code: Select all

convert -size 50x50  xc: +noise Random   -blur 0x5 -emboss 2 source.png
I try to insert this command to yours - unfortunately without a result... :-(

Can you help my for this!?!?

THANKS!!

kolorman
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help: mirroring along a diagonal

Post by fmw42 »

try


convert \( zelda3.jpg +noise Random -blur 0x5 -emboss 2 \) \
\( +clone -transpose \) \
\( +clone -sparse-color voronoi '%w,0 white 0,%h black' \) \
-composite \
\( +clone -flop -chop 1x0 \) +append \
\( +clone -flip -chop 0x1 \) -append \
zelda3_kaleidoscope2.jpg

Image
Last edited by fmw42 on 2011-06-28T10:43:46-07:00, edited 1 time in total.
kolorman
Posts: 19
Joined: 2011-03-19T14:50:16-07:00
Authentication code: 8675308

Re: Help: mirroring along a diagonal

Post by kolorman »

thanks for your answer - sorry so I´m a IM greenhorn...

thats my current code from python wirh any variables:

#1
command = 'convert -size ' + mask_width + 'x' + mask_height + ' -depth 8 -extract ' + mask_width + 'x' + mask_height + '+' + image_offsetX + '+' + image_offsetY + ' ' + input_file + ' ' + output_extract

I habe a big Picture e.g. and I crop a small image with mask_width, mask_height an an offset in x and y

#2

command = 'convert ' + output_extract + ' -sparse-color voronoi "%w,0 black 0, %h white" ' + output_mask

crate a mask

#3

command = 'convert ' + output_extract + ' \( +clone -transpose \) ' + output_mask + ' -compose Src -composite ' + output_mirror

mirror

#4

if RESIZE_VALUE == 1:
command = 'convert ' + output_mirror + ' -resize 50% ' + output_mirror_small
os.system(command)
else:
output_mirror_small = output_mirror

reseize is this wanted

#5

command = 'convert -rotate 180 ' + output_mirror_small + ' ' + output_rotate

rotate

#6

command = 'convert ' + output_rotate + ' \( +clone -flop -chop 1x0 \) +append \( +clone -flip -chop 0x1 \) -append ' + output_caleidoscope

flip amd mirror

my goal is a convert without to write image-temp-files

thanks
kolorman
kolorman
Posts: 19
Joined: 2011-03-19T14:50:16-07:00
Authentication code: 8675308

Re: Help: mirroring along a diagonal

Post by kolorman »

... important!!

the left upper corner from the original image is at my convert in the center and its "no 1"

-\6|7/
5-\|/-8
4-/|\-1
-/3|2\
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help: mirroring along a diagonal

Post by fmw42 »

Sorry I do not program Python
kolorman
Posts: 19
Joined: 2011-03-19T14:50:16-07:00
Authentication code: 8675308

Re: Help: mirroring along a diagonal

Post by kolorman »

thats without variables:

#1
convert -size 412x412 -depth 8 -extract 412x412+10+20 my_input.jpg output_extract.png

#2
convert output_extract.png -sparse-color voronoi "%w,0 black 0, %h white" output_mask.png

#3
convert output_extract.png \( +clone -transpose \) output_mask.png -compose Src -composite output_mirror.png

#4
(if resize)
convert output_mirror.png -resize 50% output_mirror_small.png

#5
convert -rotate 180 output_mirror_small.png output_rotate.png

#6
convert output_rotate.png \( +clone -flop -chop 1x0 \) +append \( +clone -flip -chop 0x1 \) -append output_caleidoscope.png

my_input.jpg is e.g. 1024x768px

thanks!

kolorman
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help: mirroring along a diagonal

Post by fmw42 »

Is there a question?

I don't think the procedure above works for non-square images. So crop it to square first and try that.
kolorman
Posts: 19
Joined: 2011-03-19T14:50:16-07:00
Authentication code: 8675308

Re: Help: mirroring along a diagonal

Post by kolorman »

hmmm... the output_extract.png is a square image (412x412px) - what is the problem?

my goal is to reduce to write the five temp-file images
* output_extract.png
* output_mask.png
* output_mirror.png
* output_mirror_small.png
* output_rotate.png

so I hope to speed up the complete converting

kolorman
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help: mirroring along a diagonal

Post by fmw42 »

what is wrong with my method provided above?

by the way
convert -size 412x412 -depth 8 -extract 412x412+10+20 my_input.jpg output_extract.png
note -size has been replaced by -define jpeg:size=

see http://www.imagemagick.org/Usage/formats/#jpg_read

also -extract probably should come after your input image.

What version of IM are you using and what platform?

Can you post a link to your example input and output images so others can test your commands if you want someone to help put them into one command line?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help: mirroring along a diagonal

Post by fmw42 »

try this:


resize=yes
rotate=yes
if [ "$resize" = "yes" ]; then
resizing="-resize 50%"
else
resizing=""
fi
if [ "$rotate" = "yes" ]; then
rotating="-rotate 180"
else
rotating=""
fi
infile="logo:"
convert \( -define jpeg:size=412x412 -depth 8 "$infile" -extract 412x412+10+20 \) \
\( -clone 0 -transpose \) \
\( -clone 0 -sparse-color voronoi "%w,0 black 0, %h white" \) \
\( -clone 0 -clone 1 -clone 2 -compose Src -composite $resizing $rotating \) \
\( -clone 3 -flop -chop 1x0 \) \
-delete 0-2 \
+append \( +clone -flip -chop 0x1 \) -append \
output_caleidoscope.png
kolorman
Posts: 19
Joined: 2011-03-19T14:50:16-07:00
Authentication code: 8675308

Re: Help: mirroring along a diagonal

Post by kolorman »

hmm... the output file is unfortunately not "correkt"

this is the commad from Python (without resize) and any calcualtet parameters

Code: Select all

convert \( -define jpeg:size=646.875x646.875 -depth 8 test2_orig.jpg -extract 646.875x646.875+17.1875+301.5625 \) \
\( -clone 0 -transpose \) \
\( -clone 0 -sparse-color voronoi "%w,0 black 0, %h white" \) \
\( -clone 0 -clone 1 -clone 2 -compose Src -composite  -rotate 180 \) \
\( -clone 3 -flop -chop 1x0 \) \
-delete 0-2 +append \
\( +clone -flip -chop 0x1 \) -append \
caleidoscope_test2_orig.jpg.png
Ther are files from the "six convert steps":

original image
Image

extract image
Image

result image
Image
kolorman
Posts: 19
Joined: 2011-03-19T14:50:16-07:00
Authentication code: 8675308

Re: Help: mirroring along a diagonal

Post by kolorman »

I work on a vServer with Ubuntu 10.04 and

Version: ImageMagick 6.5.7-8 2010-12-02 Q16 http://www.imagemagick.org

Thanks

kolorman
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Help: mirroring along a diagonal

Post by fmw42 »

What is the correct result? Can you provide a smaller example with the results of my command and from your python
Post Reply