The right approach to add shadow to an image depends on whether the final result must be a flattened raster file, remain editable in a design app, or render as part of a web page.

Start with the deliverable rather than the shadow effect. A finished PNG, an editable composition, and a responsive web element need different workflows. Once you know which one you need, you can choose sensible offsets, blur, opacity, and color without overprocessing the image.

how do i choose the right approach to add shadow to image
How Do I Choose the Right Approach to Add Shadow to Image?

Match the method to the final deliverable

There are three practical routes. A raster workflow produces fixed pixels, a native application effect remains part of an editable design, and CSS applies a live shadow to an HTML element. Each solves a different problem, so the most feature-rich option is not automatically the best choice.

Approach Best when What remains flexible Important limitation
Browser-rendered raster shadow You need a finished PNG for a thumbnail, sticker, mockup, fixture, or another image-based layout. The shadow controls are adjustable before export; the result becomes fixed raster pixels afterward. The source is decoded and rendered into a new PNG rather than preserved as an editable layered design.
App-native shadow You may still need to change the crop, colors, text, or placement after adding the shadow. The design and its effect can stay editable until you export the final file. You must finish and export inside the application, and its controls are separate from browser Canvas controls.
CSS shadow The shadow belongs to a live button, card, banner, or other element on a web page. Styles can change with the layout, screen size, state, or theme. A CSS shadow is not automatically part of a separately exported PNG, and browser rendering can vary slightly.

For a final standalone image, the raster route is usually the simplest because its output and canvas boundaries are explicit. For a composition that will receive later edits, keep the work in an application with native layer and effect controls. For a web interface, CSS is the more natural choice because the shadow remains tied to the live element.

Define the shadow’s geometry and strength

A convincing shadow needs a consistent visual purpose. Decide where the imagined light is coming from, then make the shadow direction support that idea. Images placed together should normally share the same direction, blur, opacity, and color so they appear to belong in one scene.

  • Offset moves the shadow horizontally and vertically. In the browser raster workflow, whole-pixel values run from -500 to 500. A positive horizontal value moves the shadow right, a negative value moves it left, a positive vertical value moves it down, and a negative value moves it up.
  • Blur controls the softness of the shadow edge. The browser tool accepts whole pixels from 0 to 250. A sharper edge suits a crisp cutout or interface graphic, while a softer edge can make a mockup feel more dimensional.
  • Opacity determines how strongly the shadow color appears. The accepted range is a whole percentage from 0 to 100, so the effect can range from invisible to fully opaque.
  • Color defines the shadow itself rather than changing the source image. The tool requires an exact six-digit hexadecimal color, which makes the setting easy to match with other design specifications.

These limits and directions are specific to the browser-based raster tool; another editor may use different ranges or conventions. Whole-pixel values also make a chosen setup easier to repeat across a series of assets.

Account for the expanded canvas

A shadow needs space outside the original rectangular image. The browser workflow reserves a margin equal to twice the blur value on each side and adds the absolute directional offset on the affected side. The resulting dimensions can therefore be calculated before you generate the file.

  • Output width = source width + (4 × blur) + |horizontal offset|
  • Output height = source height + (4 × blur) + |vertical offset|

For example, a 40-by-20-pixel source with 6 pixels of blur, an 8-pixel right offset, and a 4-pixel upward offset produces a width of 40 + (4 × 6) + |8| = 72 pixels and a height of 20 + (4 × 6) + |−4| = 48 pixels.

Understanding the expanded size prevents a common disappointment: the downloaded image is not expected to match the source dimensions. It also explains why a directional shadow is not silently clipped at the old image edge. The result reports its exact expanded width, height, and encoded file size.

Add and export a controlled raster shadow

Use Add Shadow to Image when you want a straightforward drop shadow around one local raster image and need the finished result as a transparent PNG.

  1. Choose the source file. Select a local JPG, PNG, or WebP within the displayed file and pixel limits. The file must be browser-decodable and no larger than 25 MiB. Decoding, drawing, and PNG encoding happen inside the current browser tab, so the image is not uploaded to a remote image service.
  2. Set the shadow controls. Enter whole-pixel horizontal and vertical offsets, choose a blur radius, set the opacity as a whole percentage, and enter a six-digit hexadecimal color. Positive offsets move right and down; negative offsets move left and up.
  3. Apply the effect. Select Add shadow. The tool draws the source with the selected Canvas shadow state and then draws it again without a shadow, keeping the visible foreground clear instead of allowing translucent shadow color to soften it.
  4. Check the expanded result. Review the preview and confirm the reported output width and height. The preview may be scaled to fit the page, but the download retains the natural output resolution calculated from the source and shadow settings. Changing the source or any setting invalidates the previous result and revokes its temporary download URL.
  5. Download the PNG. Save the generated file. The output is always a PNG named from the source, such as portrait-shadow.png, with transparent space around the image where no shadow is present.

If the input is invalid or empty, cannot be decoded, exceeds the bounded canvas budget, encounters missing Canvas support, or cannot be encoded as PNG, the tool displays an error instead of returning a completed download.

Verify transparency, resolution, and source fidelity

A technically successful export can still be the wrong result if it does not meet the destination’s requirements. Check these points before using the file:

  • Transparency: Pixels outside the source and its generated shadow remain transparent in the PNG. Areas of a transparent PNG that generate a shadow can contain rendered shadow pixels, while the visible source remains clear.
  • Resolution: Judge the download rather than the scaled preview. The natural output resolution includes the extra canvas required by the blur and offset.
  • Source treatment: JPG and WebP sources are decoded into browser pixels, so their original compression bytes and metadata are not retained in the new PNG.
  • Edge consistency: Canvas blur is a browser rendering effect rather than a print prepress measurement. Exact feather pixels can vary slightly between browser engines, as described in MDN’s Canvas shadowBlur reference.
  • CSS equivalence: A browser-rendered raster shadow should not be treated as byte-for-byte equivalent to a CSS box-shadow or another implementation. Treat each as a separate rendering method.

Keep the method that matches later edits

The decision should account for what happens after the shadow is created. If the image may need another crop, new text, a color change, or a different placement, an app-native effect is more appropriate because it can remain in the editable workflow. If the image is finished and needs transparent margins, the browser-generated PNG provides a direct path without uploading the source.

The raster workflow is intended for straightforward effects such as mockups, stickers, thumbnails, and fixtures. It does not remove a background, add a border, detect the main subject, create a perspective floor shadow, or simulate studio lighting. It also does not reproduce a specific editing application’s effect engine. Use a dedicated compositing or design tool when any of those capabilities are required.

For web work, keep the shadow in CSS when its size, color, or presence may need to respond to different states or screen layouts. Export a raster PNG instead when the image must travel through a fixed channel, such as a downloaded asset, marketplace listing, message attachment, or design file that expects a flattened image.

Make a final visual and technical check

Before delivery, compare the shadow with the image’s role rather than judging it in isolation.

  • Confirm that the offset direction agrees with the lighting implied by the design.
  • Check that the shadow is visible at its intended display size without competing with the source.
  • Look at the transparent margins to make sure the shadow is complete and not cut off.
  • Verify that the reported dimensions fit the destination’s layout or pixel requirements.
  • Open the downloaded PNG in its final context, especially if it will be composited over a colored background.

The simplest rule is to choose the route that matches the life of the file: native effects for work that will keep changing, CSS for elements that stay live on the web, and a raster PNG for a finished image asset. Within the raster route, control direction with offsets, softness with blur, visibility with opacity, and space with the automatically expanded canvas.