Shift effect with PILLOW in python - python-imaging-library

Is it possible to replicate this kind of distorion effect with pillow?
A sort of text shift distortion...
Thank you!

Related

python PIL Image open isn't RGB

i've been trying to open a .jpg image using
im = Image.open('file.jpg').
my problem is that for some reason the "im" is not an RGB image, i.e the channels are not R,G,B. this also cause the im.convert('L') (rgb2gray) give a very bad result.
channel 0 image,
attemped gray sacale.
Im using: Python 2.7.12 |Anaconda 4.1.1 (64-bit)
I would very much appreciate any help figuring this out.
edit:
it seems the problem is that the matplotlib color map isn't set right. does anyone know why? and how to fix?
You can find current mode in im.mode and do convert with im.convert('RGB').

Anyone using Emacs as front end of Mathematica?

So much I'm missing the Emacs power when I (have to) stay inside Mathematica editor. I saw a few mathematicas-mode, but they are all outdated... Any suggestions?

Create shape mask for GTK Window?

I am interested if anyone has any experience with the following function of the gtk.Window/gtk.Widget
shape_combine_mask(shape_mask, offset_x, offset_y)
I want to make the window round rather than rectangular. How do I get a shape_mask? It says that it has to be a bitmap. Should I use gtk.Pixbuf to get bitmap from an image? Or should I use cairo to get a shape with cairo_region_create_from_surface and then use another function that accepts the gtk.Region as a first argument?
It would be pretty rad if someone could post an example for this, C/C++ or preferably Python.
I use GTK version 2
Thank you in advance!
The answer to my question was provided by comment to the question and was implemented the same year in Python 2, using PyGTK and Cairo.
If anyone is interested on how to do this, you can see the working example here: https://github.com/stamat/droplets/blob/16b11c4ff96cf0b8e4fcdd85ee1cdc1fa8fb74e6/droplets/droplet.py#L127
Happy window shaping! 🪟🧩✨

Selecting a ROI manually in Matlab

I'm trying to select a user-defined area and fill with 1s, preferably with mouse input. Any suggestion how? Thanks.
The command
roipoly
does exactly what you're looking for.
You'll need the Image Processing Toolbox to use roipoly as Georg suggested.
If you don't have that, you could try creating a rubber band box using
rbbox
There's a good example in the help. You might need to fiddle with units depending on how you're displaying your data. Remember to click and hold, drag and release..
h=impoly;
This code helps you to select a closed polygon of the image.

Use "windows(width=x,height=y)" function with built-in graphic device in StatEt?

I'm working with StatEt in Eclipse. The built-in
graphic device of StatEt generally works very well
and is of big use (big thanks to the developpers).
But when I start a plot with the windows() function
to set the size (width & height) of the new window,
this window will be opened by R outside StatEt &
R crashes.
Anybody an idea what the problem could be?
Problem solved: Use dev.new() instead of windows() !