How to dynamically generate and map a 2D image onto a mug? - graphics

we need to make these images on the fly on the server.
the image should warp onto a 2d image.
The result should look like this:
The input is a texture and this:

Related

Drawing to an existing image with X-window

I am using X-window (X11) to render 2D graphics (lines, circles, text...). But rather than drawing to a window, I need to draw to an existing bitmap image. Is there a way to achieve this ? If yes, are there restrictions on the bitmap format ?
(Notice: I am not trying to render an image to a window.)
Create a pixmap via: XCreatePixmap
Create a context via XCreateGC, specifying the pixmap as the drawable.
Transfer the contents of your existing image via XPutImage (see also Transferring Images between Client and Server), specifying the pixmap as the drawable and the related context.
do your renderings via GC Convenience Routines and Graphics Functions
Get the contents from the pixmap via: XGetImage, see also Transferring Images between Client and Server
Save the image data.

Load image from JS to Phaser Game

I'm doing a custom game which I'd like to change the background and a character picture according to a file they upload.
The input file is outside phaser. If possible, I'd like to show the picture directly without uploading to the server.
If you use a file loader to get the base64 encoding of the image, you can use this.textures.addBase64 to load the image into the texture manager, after that loads you can create new objects with that image tag, or set existing images to that texture.
Working Example =>
https://stackblitz.com/edit/phaser-use-uploaded-image

Condition to check if an image is not in correct orientation and then correct it's form before processing?

I am using keras-retinanet model to detect an object from an image. Problem I am facing with this is if image is not orientated correct then model is unable to detect the object. For example if image is like this:
If I manually flip this image by 180 then model is able to detect the object.
I am doing following image processing before sending to model-
def _preprocess_image(self, image):
draw = image.copy()
draw = cv2.cvtColor(draw, cv2.COLOR_BGR2RGB)
image = preprocess_image(image)
image, scale = resize_image(image)
return draw, image, scale
In above method how can I add a check if orientation is not correct and then can correct it?
You should retrain the network with data augmentation containing all the orientations.
I don't think it is possible to determine that the image is in the original position or flip by 180°.
Unless if the origin (0,0) top left position is recorded in the meta data of the image and you have/find access to the metadata of the image itself (very unlikely possibility imo).

How to combine multiple image as single image in UWP

I have multiple image(near by 40 images), I need to combine these images as single image. I have referred the below link,
Combine two Images into one new Image
but I dint find anything like Graphics in UWP. How toacheive this requirement
Making a render target bitmap and draw the image to render target bitmap.
The example that how to draw image to render target bitmap.
And you can save render target bitmap to file, see http://jamescroft.co.uk/blog/how-to/storing-a-uwp-inkcanvas-drawing-as-an-image-in-a-storagefile/

Node create image by mixing 2 images

I've got app based on google maps. Each user is one pin on it.
I want to create pin image basing on user profile photo.
What I need to do is
Resize given image to given size (50x50px)
Make this image circle
Below this image, put base pin image (png) that has place on it for circle photo
Save final image as pin photo
Final image should be png with transparency enabled.
Is there any node library that can do such things?
Imagemagick supports image composition, and node has Imagemagick bindings.
Even though, I guess you can achieve your goal via CSS only:
resize -> browser will do;
make it circle -> border-radius: 50%;
base pin image background -> background-image.

Resources