Visuddha Karunaratne
Visuddha Karunaratne

Reputation: 536

pasting or merging transparent support image on jpeg image

Im doing an image processing project using C# which requires to apply a rim to a existing car image.im still a very beginner to image processing. so far i have found the two center points of the wheels circles and radius of those circle using C#. but i have problem with attaching the the png/gif wheel image in the original image. i need to apply the png image in to wheel. any ideas how to archive this?

Original Image:

Original image

Transparent wheel image:

Transparent wheel

Target result:

Target result

Upvotes: 0

Views: 467

Answers (1)

Polity
Polity

Reputation: 15130

The following function will draw the second image (wheelImage) on the first image(carImage) on the position specified with the size specified

    static void AppendWheel(Bitmap carImage, 
        Bitmap wheelImage, 
        float offsetLeft, 
        float offsetTop, 
        float width, 
        float height)
    {
        using (Graphics graphics = Graphics.FromImage(carImage))
        {
            graphics.DrawImage(wheelImage, offsetLeft, offsetTop, width, height);
        }
    }

Upvotes: 2

Related Questions