Batch processing "canvas" of photos with different aspect ratio

I have a number of images that differ in size and aspect ratio.

I have to give everyone a square canvas (x = y) with the picture in the middle.
With the imaging software I use (Photoshop & GIMP), I can only find the option to set and center a stack of images on a solid canvas. The problem with this is that the images that are too small for the canvas get too large a canvas and images with an aspect (y, x, or both) that is larger than the canvas, the edges of the canvas cross canvas.

Should photo editing software batch edit photos in a square aspect ratio, with the canvas size of each photo determined by the largest aspect ratio? If a photo has a size of 1400 x 600, the canvas for this picture will be 1400 x 1400, and a picture with a size of 500 x 1000 will be 1000 x 1000, with the picture in the middle and by the new aspect generated empty spaces are transparent or white.

I could use the word "canvas" incorrectly here. Think of images with different aspect ratios and sizes -> images with the same aspect ratios but different sizes.

Processing several simultaneous requests in Django, Gunicorn, Nginx

I have a problem processing multiple requests on my website at the same time. To explain it in detail – I have a Django view that gets a file from the request and then calls an API, does a calculation, and finally sends a response. Usually the site works fine, but while 100-150 requests are received, the site becomes very slow. After doing some research, I found that Django is in sync and submitting requests to its employees, which means that the server can process the number of requests from employees at a time and the other requests are queued. In my case the worker number is 3.

I have found that Gunicorn can use an asynchronous working class like gevent that does not wait for the request to complete and receives another request.
But after changing the configuration from Gunicorn to –worker-class = gevent and –worker-connection = 1000, my site doesn't respond to this particular view until I upload files. What could it be about?

My goal is to receive a request, process it (the third-party API call and the calculation on my server) and receive another request even if the previous request has not been processed. What should I do?
Something to note is that I have 1 core CPU and I have both I / O event when processing a request – the third party API call and CPU event – the calculation with the result of the API. The above calculation is our native code. I found that gevent had a problem with that because it only patches the popular Python and Django libraries. Please suggest what to do.

Thank you in advance.

Image processing – how do i get all red rectangles?

I want to find the red rectangles in this picture (there are at least seven of them):

Enter image description here

Here are my sample pictures:

examples = CloudGet @ "";

and here's what I've tried so far:

img = examples((3));
mf1 = MeanFilter(img, 5);
ht1 = HistogramTransform(mf1);
i = SelectComponents(SelectComponents(Binarize(ht1, .2), Small), Large);
bb = Last /@ ComponentMeasurements(i, "BoundingBox") // First;
bbc = Mean /@ bb;
Show(i, Graphics({Red, Opacity(0.5), Rectangle(bb((1)), bb((2)))}))

Enter image description here

Related questions:

Processing – Simple definitive integral calculator

I created this code to calculate certain integrals in processing. It works by calculating the rectangle between the maximum value between the previous function value and the current function value. Then I calculate the area by multiplying the maximum value described above and the step. And finally, the integral only sums up all areas.
I'm going to make a version based on trapezoids, but that could be very slow since I would have to use the square root function, which is computationally intensive to calculate.
Suggestions are welcome.

float step = 0.0001;
int iterations = 0;

// y = x
float f1(float x) {
  return 2 * x;

float integral(int a, int b) {
  float sum = 0.0;
  float prevI = a;

  for (float i = a; i < b; i += step) {
    float h = max(f1(prevI), f1(i));    
    sum += step * h;

    prevI = i;
  return sum;

void setup() {
  println(integral(0, 1));

Image processing – How to find the length of the wall sizes

I calculated room size from Mathematica. Now I have to classify between the walls from the pictureEnter image description here

My second edition should come from the source image. I have to classify similar walls based on their thickness and categorize them along with their lengths as outer wall 1, inner wall 2. I am new to Mathematica and any help is appreciated

Source image: Enter image description here

us citizens – processing time of the Nexus card

How long will it take to get my Nexus card?

I applied online today and need to schedule an interview at the Enrollment Center in Blaine, WA, after hopefully receiving approval:

I live in Redmond, near Seattle, have my US passport, and am a US citizen.

I am traveling to London, UK in late March 2020 and would like to have the Nexus card so I can jump the long safety line at Sea-Tac Airport. I know the Nexus card is not useful for skipping long lines at London Heathrow Airport.

I would appreciate responses from people who actually applied for the Nexus card in late January or early February. I heard from a friend that a winter application can be processed faster than a spring or summer application.

Calculate the time in data processing in XML and CSV

I have created a program (C #, .NET) that calculates the time for XML and CSV export, and please have a question to improve my programming skills. Do you think I can improve the structure of the program? Or what do you think about code refactoring? Kind of solving … is it good? I uploaded the project to github.
Thanks for your comments.

                    t.SetupWriteStart(TestType.String); //that inicialize collection, stringreader, stringstringwriter
                    Time = CalculateTime(t.TestWriteString);
                    t.SetupWriteEnd(TestType.String); //delete this collection, close stringreader and writer

Github link

Image processing – segmenting a cat's side profile and drawing a line around the edges

My goal is to segment the side profile of a cat's head and draw a line on the edges of the cat's face.
The cats have different backgrounds, colors and qualities, and the characteristic (face edges of the cat) is in different positions in each picture.

I experimented with opencv and scikit-image (manual region of interest) in Python, but I'm not sure which method gives the best consistency.

What would be the most suitable method for this?