How to compensate for uneven illumination in a photograph of a printed page?

I am trying to teach my camera to be a scanner: I take pictures of printed text and then convert them to bitmaps (and then to djvu and OCR'ed). I need to compute a threshold for which pixels...

Convert source code to syntax highlighted image

Background OpenOffice Writer lacks the ability to link to an ASCII text source file, apply syntax highlighting, wrap it in a frame, and update the frame contents whenever the source file changes....

Detect corrupt JPG images in python (which module/library can do it)

I read JPG's from an IP-camera and want to detect corrupt images. This is my function to load the image: from PIL import Image def getImage(self): r=self.http.request('GET', self.snapshotURL,...

How does one add an item to GTK's "recently used" file list from Python?

I'm trying to add to the "recently used" files list from Python 3 on Ubuntu. I am able to successfully read the recently used file list like this: from gi.repository import Gtk recent_mgr =...

Gimp Python plugin loading image disables undo history

I have a set of images that I am trying to process manually, so I wrote a simple plug-in to try and help make it a little less painful. The images are numbered sequentially. So when I finish...

Gimp script-fu working only sometimes

I'm not really one of the graphic savvy people so I kinda hit a wall with this script found on the interwebz ( define (script-fu-pcb-filter img) (gimp-image-convert-grayscale...

Errors converting pdf to jpg using wand, Imagemagick, and Django

I am using ImageMagick 6.7.7-10 2017-07-31 Q16 on Ubuntu 14.04, through Wand 0.4.4, Python 3.4.3 and Django 1.11. I am trying to create a jpg thumbnail of a pdf file. On the command line, I can do...

Extract image from video for print at 300 dpi instead of 72 dpi

I made a video of some landscape with a camera. After connecting the camera to a tv screen and playing the video, it all rendered wiredly (bug) but beautifully (a bit like impressionism). As the...

Gimp Python plugin gimp.Image as numpy array

I'm working on a python plugin for GIMP and I would like to obtain the RGB matrix of a layer as a numpy array. To access the layer in the python plugin I use the next code: def...

Using python3 tifffile writing tiff image stacks unreadable

I have a 3D numpy array storing 16bit intensities for a 3D image. I would like to use tifffile module to create a image sequence along z-axis: import numpy as np import tifffile as tiff data =...

How to correctly spawn a subprocess with Tkinter and exit?

I'm trying to write a simple python(3.7) program using Tkinter which, upon clicking a button, will spawn a process and terminate the Python script. The spawned process should not be killed. The...

How to keep ChildProcess from running out of memory? Electron/Node.js

Using Electron and Node.js to write a simple user interface to a process that generates data, and then allows the user to call gnuplot to show the data. Here is the code in main.js that calls...

coordinate location based off pixel color

I am trying to get specific coordinates in an image. I have marked a red dot in the image at several locations to specify the coordinates I want to get. In GIMP I used the purist red I could...

batch resize images with gimp

I want to resize every jpg in a directory. This is the gimp script I've found. Looks sensible to me. (define (batch-resize pattern) (let* ((filelist (cadr (file-glob pattern 1)))) (while...

How to debug script-fu scripts for gimp in scheme?

I try to make some script for gimp, using script-fu, scheme. Naturally, as a beginner, there are lots of errors and misunderstandings. Now I'm looking for a way to debug those scripts. I found...

Convert .pgm file to csv file in python,

I need to find out how to convert .pgm file to .csv file in python. I have been learning python for 2 1/2 weeks so if anyone helps could you please keep my lack of knowledge in mind. I am using...

How to convert greyscale bmp in imagemagick

I am trying to convert a greyscale png to a bitmap (bmp3 version) with the following attributes: Format: BMP3 (Microsoft Windows bitmap image (V3)) Class: PseudoClass Type: Grayscale ...

Randomness of Python's random

I'm using Python to generate images using dashed lines for stippling. The period of the dashing is constant, what changes is dash/space ratio. This produces something like this: However in that...

Anaconda selecting correct enrivonment but wrong sys.path?

I have different anaconda environments. When starting up one of them it seems as if sys.path is still set to some totally wrong directory. Am I not understanding the concepts of environments...

Drawing full screen chessboard pattern?

I'm working in OpenCV (camera calibration and then creating 3d model) and till now I always printed a checkerboard pattern on paper and then took pictures needed for calibration. I tried to find a...

Change JPEG file DPI header in Node.js

I have a file (for example JPEG size 1588 × 2244px). It's generated by puppeteer (but phantomjs also generate 72 DPI screenshot). When I save this image into a file with .jpeg extension and I use...

Converting a sequence of ppm images to video with python

I'm trying to make a video out of ppm images using IPython (python 2.7). I wrote this code : import cv2 import glob img1 = cv2.imread('C:/Users/Joseph/image0.ppm') height, width, layers =...

Gimp Python script not showing in menu

I am trying to write a python-fu script to simply print a warning to the error console. I have this same thing working fine with schema-fu. But its not showing on the menu with python-fu. I have...

Why does Tkinter Canvas widget show images at a wrong scale?

I'm trying to open image files and display them in python 3.8 using Tkinter and Pillow, but something is scaling the images wrong on my screen. import tkinter as tk from PIL import Image,...

Why would converting CMYK image to sRGB for display on web work locally, but not on prod server?

Our graphic artist is delivering image ready for print in CMYK colorspace JPG format, which is correct for printing. I am converting these for display on the web. I understand the "best" thing...

OpenCL ray tracer works fine on CPU but not (always) on GPU

[Please look at the edit below, the solution to the question could simply be there] I'm trying to learn OpenCL through the study of a small ray tracer (see the code below, from this link). I don't...

Cannot open .jpg, .png, or .tif files with ImageMagick, only .gif files work

I am using Ubuntu 18.04.1 LTS (Bionic Beaver) on Windows Subsystem for Linux. I installed ImageMagick according to these instructions, the only exception being ImageMagick version is currently...

Python OpenCV sorting contours in clockwise

I'm putting together an image processing tool to follow the deformation of a part using images. The part has rectangular markers that get detected with image segmentation and cv2.findContours...

Getting a list of differences between list of installed packages and list of desired packages in ansible

(See update2 below for my final word on this.) I'd like to have ansible generate a list of missing packages by comparing the installed packages with a list of desired packages. (The list of...

Python handwritten text extraction

I need to extract some text from a image file but I'm not having good results with the handwritten info. It is written on a printed paper which I scanned back with proper scanner The handwritten...