Thanks to @SquareOne effort I generated higher-resolution videos with smoothing transitions that can be seen here:

I might post my version of @SquareOne code with some bug corrections later. I am grateful to this community and @SquareOne for outstanding support.


Dear friends, as you know there is currently an ongoing war in Ukraine: https://war.ukraine.ua

I need your help on some coding in image/video processing, which is very simple to formulate, but not obvious in execution. Smooth exactly-timed transitions between video frames and perfect alignment of video frames is a key challenge here. BOUNTY TARGET IS EXPLAINED AT THE END OF THE POST.

DATA Description

United States' Institute for the Study of War (ISW, "a non-partisan, non-profit, public policy research organization") performs daily research and publishes daily maps of the battlefield. Their work is public and gives many references to data sources they use. For instance...

The whole-Ukraine overview map from the 1st day of invasion on FEB 24, 2022 (source):

enter image description here

A recent whole-Ukraine overview map from APR 19, 2022 (source):

enter image description here

DATA Source

These maps are published almost daily with all publications gathered here: https://www.understandingwar.org/publications



Basic part for the BOUNTY:

  • Programatic data access. While URLs of daily articles and images follow some pattern, it is not always regular. How do we write a piece of code that accesses whole-map programmatically? We do not want do do this manually. Approach 1: look at the daily image URLs (example), but they are still not regular. Approach 2: look at the daily articles URLs and get 1st image from the article (example), but they are still not regular. Maybe there are other approaches. START DAT: FEB 24. END DATE: CURRENT DAY.

  • Each frame must have a date stamp. For example: FEB 24, 2022, FEB 25, 2022, etc.

  • Image alignment of Ukraine border - the GREATEST challenge. All these maps-images are slightly different. Ukraine country border should NOT jump from frame to frame.

  • Duration of a frame and smoothness of transition Each map-image (key-frame) should be held on screen 1 second. Each of 3 transitional blended frames should last 0.15 seconds. This is a toy example of how to achieve it. Imagine you have just 3 key-frames.

enter image description here

Build transitions via interpolated blended frames:


enter image description here

Define non-inform timings as

In[68]:= timings=Flatten[Riffle[Table[1,3],{Table[.15,3]}]]

Out[68]= {1,0.15,0.15,0.15,1,0.15,0.15,0.15,1}

Create video as

SlideShowVideo[frames -> timings]

enter image description here

Export to .MP4 via


Thank you very much for considering this!!! Collecting data from independent sources, and displaying it in a comprehensive animation, can help to inform society in ways that numbers and unorganized static images cannot. This is the sort of thing we as a community can do best in these difficult times.

  • 9
    $\begingroup$ @user64494 your comment is off-topic in my opinion. I read the question carefully. Oh and yes. War is war. It's not politics and it's not ideology. $\endgroup$
    – bmf
    Apr 20, 2022 at 16:18
  • 15
    $\begingroup$ @user64494 I do not see ideology in using publicly available information that can be criticized and scrutinized. It shows a very relevant and useful application of WMA. You vote to close and I will vote to reopen. Simple as that. ;-) $\endgroup$
    – gwr
    Apr 20, 2022 at 16:19
  • 12
    $\begingroup$ I am asking for real coding help guys, real programing. These are NEUTRAL DATA from "a non-partisan, non-profit, public policy research organization". We do COVID data things right, while it is too can be political? But we help public to get factual knowledge. Sometimes code it might concern data about politics -- but this is no reason to block the pure data and code part of it. Even Reddit DataIsBeautiful allows such entries -- and that is 17 million people sub-reddit with a lot of respect. Thanks :-) $\endgroup$ Apr 20, 2022 at 16:24
  • 12
    $\begingroup$ @e.doroskevic This content is as real and relevant to the public as was COVID-19 information. It touches human lives and the study of war can be and has been done in a scientific way. $\endgroup$
    – gwr
    Apr 20, 2022 at 16:24
  • 12
    $\begingroup$ Addressing the question raised by @AntonAntonov, good answers here could have applicability for animating any data that changes over time and is cartography-based. Natural disaster zones come to mind, in terms of helping to determine what resources to focus where at what time. Another application might be charting deglaciation over decades. Sure, these both involve politics and policy. But the idea is to provide the best technical resources to aid in decision-making. This is important independent of the question at hand. $\endgroup$ Apr 20, 2022 at 19:17

3 Answers 3


enter image description here

Here is a link to a mp4 video (400 pixel width without fade transition due to memory limit in the the free basic Wolfram Cloud)

1. Fetching

The idea is to search all the ukraine-project pages for the links to all the reports containing the maps images. The name of the reports and of the images are searched given some keywords-string patterns.

All the images are downloaded locally (these are big images which need resizing).

maxpages= Import[webpage,"Hyperlinks"] // Select[StringContainsQ[pagePattern]] //StringCases[pagePattern~~d:DigitCharacter..->d] // Flatten//ToExpression // Max;

Range[0,maxpages] // 
Import[webpage<>pagePattern<>ToString@#, "Hyperlinks"]//

Import[#,"Hyperlinks"]//Select[ StringContainsQ[imageTitlePattern]]//Union}&];


2. Resizing

Once downloaded locally, the original maps are resized for convenience and are also directly renamed with the corresponding map date.


{pattern,filedatePatterns}]// Map[Select[Length@#[[2]]==1&]]//Join@@#&//Map[Flatten];


3. Aligning

The maps are aligned according to a caracteristic pattern which is always visible on all maps.

enter image description here

This image pattern is a small portion of the black sea on the east side with also two country borders:

enter image description here

The best results are obtained when extracting and comparing the edges of the images:

ImageTake[#,{280,360},{250,295}]& //EdgeDetect[#,1]&

enter image description here

ImageCorrelate is used here to find the positions where the image pattern best matches the maps. It is then be possible to center all the maps onto this position-pattern.

bestpos[img_,pattern_]:= ImageCorrelate[img, pattern, 
NormalizedSquaredEuclideanDistance, Padding -> None] //
ColorConvert[#,"Graylevel"]& // ImageData // Position[#, Min[#]]&//
{#[[1,2]],ImageDimensions[img][[2]]-#[[1,1]] -ImageDimensions[pattern][[2]]}&



4. Movie

Assembling the images into a movie as indicated by @Vitaly:

SlideShowVideo[frames -> timings]


Just a proof of concept with 4 maps, i have not finished yet. I tried to align the full images with different approaches, ImageCorrelate seems to give here the more robust results.

enter image description here

  • $\begingroup$ +1 Excellent start, thank you! I am looking forward to see the code - surprising ImageCorrelate works with such randomly-detailed images. Can't wait to see the .mp4 :-) $\endgroup$ Apr 29, 2022 at 2:29
  • 1
    $\begingroup$ This does look quite good. But it needs the code in order to count as a proper MSE response. $\endgroup$ Apr 29, 2022 at 3:12
  • $\begingroup$ @SquareOne it is just 1 hour left :-) Actually it maybe a bit more - I think there is a small grace period after bounty ends. $\endgroup$ Apr 29, 2022 at 18:38
  • 1
    $\begingroup$ @VitaliyKaurov I am working on it ... I hope I will make it $\endgroup$
    – SquareOne
    Apr 29, 2022 at 18:53
  • 1
    $\begingroup$ @VitaliyKaurov Ok, I have a very weird bug somewhere, I will be back in a few hours ... (it is the night here) ;) $\endgroup$
    – SquareOne
    Apr 29, 2022 at 23:03

Here's a first pass at naively grabbing and animating the main map frames:

april = Table[
dayImgs = Import["https://www.understandingwar.org/backgrounder/russian-offensive-campaign-assessment-april-"<>ToString[n],"Images"];
img = dayImgs[[5]]; (* brittle *)


enter image description here

Or you can try:



Another approach could be to try registering with GeoGraphics and using color analysis to get "the locations", here's a sketch:

dayImgs = Import["https://www.understandingwar.org/backgrounder/russian-offensive-campaign-assessment-april-18","Images"];
img = dayImgs[[5]]; (* same as above *)

(* Extract the legend colors and overlay graphics *)
{rc,uc}={RGBColor[0.9568629185428273, 0.6901959859893049, 0.6862744789494377, 1.], 
 RGBColor[0.6666667137194934, 0.9137255348660686, 0.9882353221073724, 1.]};
{ru,ua}=Image[ColorReplace[Image[DeleteSmallComponents[Binarize[Blur[ColorDetect[i, ColorsNear[#, 0]], 6], .1]]],
{White->#, Black->Transparent}],ImageSize->{613.7,650.6}]&/@{rc,uc};

GeoRange->{{38.5, 53.89}, {24.69, 39.5}},ImageSize->{613.7,650.6}, (* guesstimates *)
GeoProjection->"Mercator", GeoBackground->"CountryBorders"];

enter image description here

  • 2
    $\begingroup$ +1 Thank you! Quite elegant in its compactness. If I understand correctly you are alleging images simply by their sides, using the fact that it looks like Ukrainian border is always in the same position within the map? BTW there are a few reasons to keep the top and bottom parts of the frame - like it has the date, other info, etc. But this is a great start! $\endgroup$ Apr 20, 2022 at 21:49
  • 2
    $\begingroup$ The size of the blue top and the bottom footnote sections sometimes change in height, to keep the image aligned I removed them. Instead, you could use TextRecognize on the header and footer and add labels or annotations. If you have any next step ideas here, please chat me and I'd be happy to try and add them. $\endgroup$
    – user5601
    Apr 21, 2022 at 0:12
  • $\begingroup$ I updated technical details (see the end of the post) and posted 500 bounty. Thanks for the consideration and help. $\endgroup$ Apr 22, 2022 at 20:42
  • 1
    $\begingroup$ @VitaliyKaurov it's straightforward to do what you're asking now with these snippets, I'll try to finish your 500pt request tonight $\endgroup$
    – user5601
    Apr 26, 2022 at 22:14
  • $\begingroup$ I am looking forward to it, thank you! $\endgroup$ Apr 27, 2022 at 20:46

With my limited knowledge I could do Programmatic data access. I hope it would be useful for other answers.

The code provided in this answer is introduced to show the procedure and the author does not hold any responsibility for its usage.

Although some days don't have images (like February 20) and there isn't a consistency in naming, below code almost find all the images to this date (except for March 20 which is named really differently).

The code below defines a function named scrapImageURLs which returns a list of image URLs based on your second approach (opening the URL and looking for the image). Then use URLDownload to download them on your computer and process them.

You can use "StartDate" and "EndDate" options to filter your requests.










imageURL=StringCases[response["Body"],"https://www.understandingwar.org/sites/default/files/draft"~~Shortest[___]~~((justDayString~~Shortest[___]~~"ukraine")|("ukraine"~~Shortest[___]~~justDayString))~~Shortest[___]~~".png",IgnoreCase->True],Print["   ERROR on "<>dayString<>"\n   "<>url<>"\n   \"StatusCode\": "<>ToString[response["StatusCode"]]];getError=True;];

If[Length@imageURL=!=0,Print[First@imageURL];First@imageURL,Print["   No image found on "<>dayString<>"\n   ",url];Nothing],Nothing]





  • It uses URLRead which was introduced in version 11.
  • Since it could fail at any moment during execution, it'll print the result/error it faced while executing and return a list of valid image URLs (for days that have an image and don't get an error).
  • It assumes the image filename starts with "draft" and ends with ".png" and the day and the word "ukraine" is also included (for example March-19 has 19 in its name)
  • Please save the URLs and only request for days that you don't have.

Just to avoid putting pressure on servers, here is the list of image URLs up to 2022-4-20:

  • $\begingroup$ +1 Thank very much - this is very useful! I hope it is robust against possible typos in their URLs, so we do not miss a date. $\endgroup$ Apr 20, 2022 at 21:42
  • $\begingroup$ Thank you for your kind words. Its robustness could always fail facing unpredictable names, but overall it'll find most of the links and when it doesn't, the post URL along with a "no image found/error" text will be printed to get it manually. I hope the list doesn't get much bigger. $\endgroup$
    – Ben Izd
    Apr 21, 2022 at 6:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.