A little off topic... BUT (note change of subject).
fmw42 wrote:It would be kind of neat is one could do the same with gradient to match the size of the input image as in your tile example.
You can... It is called
-sparse-color!!!!
Two point
Barycentric to be precise!
IM automatically calculates the third point needed so that a linear gradient is place between the two points with the gradient perpendicular to the line between the two points. But you can create a your own thrid point using the same color as one of the other two to set the 'angle' of the gradient.
It takes percent escapes too, so you can specify the image size! How about one across the image...
Code: Select all
convert rose: -sparse-color Barycentric '0,0 black %w,0 white' horizonal_gradient.png
That by the way is a perfect mathematical gradient across the image, using 'image coodinates', so that the color points are positioned at the exactly image edge. As such the fist and last pixel is not actually exactly white or black.
Gradient however calculates using 'pixel coodinates' from top row of pixels to bottom row of pixels, which if you remember was why you had 'noise' in your FFT transforms of your
gradient -> sine_evaluate -> FFT results. The starting gradient was not 'mathematically perfect and thus not 'tileable' as it was one pixel short!
To get EXACTLY the same as gradient: (vertical) with the same image size, you need to specify pixel locations using 'image coordinates.
Code: Select all
convert rose: -sparse-color Barycentric '0,0.5 white 0,%[fx:h-0.5] black' rose_gradient.png