# How to extend an Image from side to side softening the hard edge of image

I have an Animation of the Sun Series: see youtube.com/playlist?list=PLR0QoztQVGtiHcwhVtd9i7qfvNkVm3m6c as you can see from the Image below

The Corona or Radiating Fire of the Sun has a edge on both sides sometime, sometimes they extend up and down, but not much, and the few times this did happen I fixed them by hand.

This is a NASA public domain images of the Sun in AIA 193 4096x4096 format, with an Environment image texture of the Stars as background.

What I want to do is soften the hard line so it looks more like this:

I just did a fast Smudge by hand in GIMP, and asked this same question on their Forum.

There are over 33,333 images for one Year and I have over 6 years of images that I am working with, that is over 200,000 images, so I can not do this by hand in my lifetime since I am dying of Cancer my time is limited, I am old and have Arthritis as well, so it would be a very painful way to go out, and I might not finish it, so why start, but I wanted to finish this series, and go back and do years before the series started, which is 2010, so people can view the sun over a decade, but the hard edge looks bad, and I know there is a way to fix this, but I am not good enough at blender to figure it out, my guess is that I need to write a script that takes the edges of the images and blurs it side ways in an oval shape, no idea how to do that, anyone have any ideas?

I originally did the video in 1080, now I want to render it in 2160, since the originals are larger then the 3840, it should look good at 4k, but I want to fix this issue since it will take a long time to render all these images.

This will be just as hard to wrap my brain around, it deals with using a Gimp Plugin GMIC, I have no idea how to do this, so its going to be a huge learning curve, normally this would not be an issue with me, being sick is making it hard to focus on learning new things, not looking for someone to do the work for me, just looking for more information on how to do this, in a way I can figure out how to do it.

Using Gimp and a plugin, its possible to write a CLI command, using bash I can apply it to all the images, it would have to resize the canvas, then know the location to apply the effect, my guess is that this will take time, if its faster and easier to do this in Blender is a good question, both require me learning how to do it then doing it.

Thanks

• I think this will be the first such statement in comments in history of BSE, but well... To much details. – cgslav Jul 23 '17 at 20:19

You can blend the edges outwards by manipulating the texture coordinates to stretch out the image at each edge. To achieve this you can use an RGB Curves node to set the profile of the Red channel (X) to bend out the edges as follows :

To create the curve, disable clipping (click the round dot button and click the 'Use Clipping' button to disable it), create 4 additional control points, and set the 6 control points (by clicking each point in turn and typing the coordinates into the X and Y fields) to the following values :

1. -0.5, 0.0
2. 0.08, 0.08
3. 0.09, 0.09
4. 0.91, 0.91
5. 0.92, 0.92
6. 1.5, 1.0

This will produce a curve that is straight in the middle section (resulting in no distortion in the middle of the image) and which flatterns at the ends (which will spread the extremeties outwards).

Note : Move points 2,3,4,5 closer to or further from the corners to blend less/more of each edge of the image. eg, moving point 2 to 0.04,0.04 and point 3 to 0.05,0.05 will blend less of the leftmost edge - the closer these points get to zero the less of the image edge will be blended. Similar for points 4 and 5 but the closer they are to 1.0. Moving points 1 and 6 closer in will reduce the extent of the blending.

Note the Mapping node to adjust the coordinates to add an additional 0.25 at the start and end of the Generated coordinate range.

This will spread the edges as shown :

This can be further manipulated using Maths nodes to 'curve' the edges with a Cosine operator and to fade out the edges as shown :

This can produce the following result :

This could potentially be enhanced by including noise in the blended section and/or the cosine to make it less uniform if desired.

Blend file attached

• This works for me, thank you so much, just one question, how can I make the Black Transparent so the Stars show through? I tried this from the Compositor using the Difference Key, but when I alpha over the Sun it did not work for some reason, as a result the hard edge is still there also, my guess is that the Material is not transparent, no idea how to change this in Cycles, in Blender it was a property, so I get a contrast of the two black colors, and I do not know how to convert these Nodes to those compatible with the Compositor and get the same effect, without using an Object. – Jeff Flesher Jul 24 '17 at 22:28
• @JeffFlesher Glad to help. Not sure I understand fully the problem with the stars. You could try combining the output from the Emission Shader node with a Transparent Shader node by way of an Add Shader. This should result in transparency. If this doesn't help then probably best to submit a new question. If you do then let me know (by posting here) and I can take a look. – Rich Sedman Jul 24 '17 at 23:09
• The only issue I now have is that the Date Time Stamp at the bottom is being erased, and also it looks like the transformation is taking place to close to the Sun, since not all the image will have a Hard Edge, I need to only effect those images that do, and I don't want to effect what Corona is already there so I could alpha over the original to fix that, so how do I adjust it so it only effects images that the Corona extends past the edge? Here is a link to an image without Corona link – Jeff Flesher Jul 25 '17 at 0:14
• I take that back, adding a Transparent Shader makes the Stars show through the Sun, so what I really need to do is make the Black Transparent, so you know how this can be done, or is this because the original is jpg and it does not support Transparency, if so will I have to convert all the files? That takes a long time and a lot of hard drive space so I want to make sure its necessary. Thanks for all the Help. – Jeff Flesher Jul 25 '17 at 0:46
• In the case I need to convert jpg to png to get transparency, is there anything else I should do to the image, normally I use IM to convert the images like this: mogrify -alpha set -background transparent -format png -path ../2016-png *.jpg if I wanted to make canvas larger I could add -gravity center -extent 4696x4096 , so I have 300 px on both sides to work with if needed, just not sure what I need to do to get this effect, not sure if adding -background transparent does anything if I do not extent, but it takes days for this to run, last time power when out, start over, or write script. – Jeff Flesher Jul 25 '17 at 1:24

Perhaps the best method is not to look at just the sides that are now flat edged, but at looking at rotation the portion of the image that is outside the ringed edge of the sun to overlay on the sides and possibly use some feathered masks to blend them into the existing frame.

• Yes that was recommended Blender Artists but the Sun does not always have a Corona on the top or bottom, its minimal most of the time, I was hoping for an extended look, and not something that does not match or look real, really what I want to do is just a Smudge from about 10 px out to 300 px tapering, like I did in my example, if I do only 10 px, it will just smudge the black if there is no Corona, because that too is what happens at times in the year. Thanks. – Jeff Flesher Jul 24 '17 at 0:29