Page 2 of 2

Re: Creating a logrithmic grid?

Posted: 2017-11-03T17:56:12-07:00
by troybtj
using the last style above:
Image

This has been useful, now the people who view this think the lines should be slanted 15 degrees or so. Say each of those lines above are 10 pixels tall, leaving the bottom of the line where it is, the top of each line should end up 3 or 4 pixels to the right.. Not a 45 degree slant like ////, but it's similar, just with a smaller angle. Something that suggests 'movement'.

The rotate commands I've tried end up doing the entirely wrong thing, I guess it's something to change in the function for the line that I'm messing up on here, though I'm still on the 'old' imagemagic. I have one system with 7.0.5-6 and one with 6.8.9-9 versions.

Is this an easy wizzard trick, or is it more complex than that? Is there a good study manual for the function with demoo's beyond fmw42's site?

Re: Creating a logrithmic grid?

Posted: 2017-11-03T18:10:03-07:00
by GeeMack
troybtj wrote: 2017-11-03T17:56:12-07:00The rotate commands I've tried end up doing the entirely wrong thing, I guess it's something to change in the function for the line that I'm messing up on here, though I'm still on the 'old' imagemagic. I have one system with 7.0.5-6 and one with 6.8.9-9 versions.

Is this an easy wizzard trick, or is it more complex than that? Is there a good study manual for the function with demoo's beyond fmw42's site?
You might look at the "-shear" operator. A command like this will horizontally slant the image 15 degrees to the right...

Code: Select all

convert input.png -shear 15x0 output.png
You'll still have to decide what to do with the ends and handle them as needed. If you add "-alpha set -background none" after the input image, the leftover wedges at the ends will be transparent.

Re: Creating a logrithmic grid?

Posted: 2017-11-03T19:30:32-07:00
by troybtj
Thanks! The second convert command wiped out the transparency, but found a quick workaround for that!
Commands:

Code: Select all

$ magick -size 1x50 xc:darkblue -duplicate 39 -scale %[fx:t+1]x50! -bordercolor none -border 5x0 -reverse +append out.png

$ convert -background transparent out.png -shear 15x0 outputs.png
Output:
Image

For some reason, the word "skew" is the word I was thinking of but couldn't figure out when I wrote the post explaining what was needed, but my brain-thesaurus index needs rebuilding. :D

Once again, you've made it simple.

The hard part remaining. My Python code only has the Imagemagick 6 support. Is this something available in that using the long formats on the previous page and the skew command?

Re: Creating a logrithmic grid?

Posted: 2017-11-03T20:21:49-07:00
by fmw42
You can do it all in one command.

Code: Select all

magick -size 1x50 xc:darkblue -duplicate 39 -scale %[fx:t+1]x50! -bordercolor none -border 5x0 -reverse +append -background transparent -shear 15x0 out.png

Re: Creating a logrithmic grid?

Posted: 2017-11-03T21:28:03-07:00
by GeeMack
troybtj wrote: 2017-11-03T19:30:32-07:00The hard part remaining. My Python code only has the Imagemagick 6 support. Is this something available in that using the long formats on the previous page and the skew command?
As fmw42 mentioned above, the entire process can be worked into a single command. When using IM6 you're somewhat limited using variables within the command, but it can be done. Here's a command that should produce a result nearly identical to your example using any IM6 from about 6.7.7 to current, and even IM7 by changing "convert" to "magick".

Code: Select all

convert -size 40x50 xc:#000080 -duplicate 39 -bordercolor none -background none -virtual-pixel none \
   -distort SRT "0,0 %[fx:(t+1)/n],1 0 0,0" -trim -reverse -border 4x0 +append -shear 15x0 output.png
Change the continued line backslash "\" to a caret "^" to make it work in Windows.

Re: Creating a logrithmic grid?

Posted: 2017-11-03T22:35:11-07:00
by troybtj
Thank you, GeeMack! That works, now I've just got to put it into the python script for text, which I've got set up.

When messing with an otherwise boring task, I love adding things like this to make it look more recent than 1980, but not too much more, and add in all sorts of useless glam here and there, so I love IM!

Re: Creating a logrithmic grid?

Posted: 2017-11-03T22:39:00-07:00
by fmw42
Out of curiosity, how are you convert this to Python? What tools do you use --- skimage, numpy, opencv? Or Wand or Pythonmagick? Or are you use a subprocess call to a shell script from python?

Re: Creating a logrithmic grid?

Posted: 2017-11-03T22:56:36-07:00
by troybtj
I'm now just using a shell call to bash since it's not a secure system, and I use some of your (Fred's Scripts) which I just looked and realize I need to update. For simpler stuff like resize or auto-color-correct, I've used the python-imageck library, ported from PHP.

I have looked at the python-libmagick++ which is just a wrapper to call the C++ library libmagick++ functions (lib from imagemagick.org). However, I've not found enough documentation (ok, desire to read what I have found, to be honest) to get those commands into individual calls in the right order. for this creation. 🤓

I'm now just using it as a background piece to overlay and draw text on it which is then overlaid again.

Re: Creating a logrithmic grid?

Posted: 2017-11-03T22:59:16-07:00
by fmw42
What is "python-imageck"? Did you spell that correctly? Do you have a link to it.

Re: Creating a logrithmic grid?

Posted: 2017-11-03T23:04:55-07:00
by troybtj
Sorry, I left off the link: https://secure.php.net/imagick

--ETA: That's the php version, I have no clue where I got the python wrapper for that at, titled the same.