Papers › Painterly Image Harmonization using Diffusion Model

Painterly Image Harmonization using Diffusion Model

4 Aug 2023arXiv:2308.02228archive 2025-07-28

Lingxiao Lu, Jiangtong Li, Junyan Cao, Li Niu, Liqing Zhang

Painterly image harmonization aims to insert photographic objects into paintings and obtain artistically coherent composite images. Previous methods for this task mainly rely on inference optimization or generative adversarial network, but they are either very time-consuming or struggling at fine control of the foreground objects (e.g., texture and content details). To address these issues, we propose a novel Painterly Harmonization stable Diffusion model (PHDiffusion), which includes a lightweight adaptive encoder and a Dual Encoder Fusion (DEF) module. Specifically, the adaptive encoder and the DEF module first stylize foreground features within each encoder. Then, the stylized foreground features from both encoders are combined to guide the harmonization process. During training, besides the noise loss in diffusion model, we additionally employ content loss and two style losses, i.e., AdaIN style loss and contrastive style loss, aiming to balance the trade-off between style migration and content preservation. Compared with the state-of-the-art models from related fields, our PHDiffusion can stylize the foreground more sufficiently and simultaneously retain finer content. Our code and model are available at https://github.com/bcmi/PHDiffusion-Painterly-Image-Harmonization.

PaperPDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2308.02228")

Code

Syntology Ran 13 of 16 code samples harvested from 1 repository linked to this paper; 3 have no recorded run. Of those that ran: 2 ran · violated contract; 1 ran · our draft was wrong; 10 ran with no contract checked.

By repository: official repository: 16 samples from 1 repository, 13 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

bcmi/phdiffusion-painterly-image-harmonization officialmentioned in papermentioned on GitHubpytorchApache-2.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

16 samples harvested; 13 ran; 0 honoured the contract we drafted; 3 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · violated contract
1ran · our draft was wrong
10ran
3unverified

Licence: 0 of the 16 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from bcmi/phdiffusion-painterly-image-harmonization. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

analytic_kernel bcmi/phdiffusion-painterly-image-harmonization/ldm/modules/image_degradation/bsrgan.py official repository ran fingerprinted Apache-2.0 (permissive) · b04722a19845dc90 · report
anisotropic_Gaussian bcmi/phdiffusion-painterly-image-harmonization/ldm/modules/image_degradation/bsrgan.py official repository ran Apache-2.0 (permissive) · 5a0ca1bba88bb4b0 · report
calc_mean_std bcmi/phdiffusion-painterly-image-harmonization/loss/VGG_Loss.py official repository ran fingerprinted Apache-2.0 (permissive) · c50f180220dfde34 · report
default bcmi/phdiffusion-painterly-image-harmonization/ldm/modules/attention.py official repository ran · violated contract Apache-2.0 (permissive) · 424012cb37b31172 · report
exists bcmi/phdiffusion-painterly-image-harmonization/ldm/modules/attention.py official repository ran · violated contract Apache-2.0 (permissive) · aa5486a3650902d8 · report
get_foreground_mean_std bcmi/phdiffusion-painterly-image-harmonization/loss/VGG_Loss.py official repository ran Apache-2.0 (permissive) · d5caf57e1135f67f · report
get_image_paths bcmi/phdiffusion-painterly-image-harmonization/ldm/modules/image_degradation/utils_image.py official repository ran Apache-2.0 (permissive) · f9d4c247328f3337 · report
is_image_file bcmi/phdiffusion-painterly-image-harmonization/ldm/modules/image_degradation/utils_image.py official repository ran Apache-2.0 (permissive) · 226f6afcd57ff476 · report
isimage bcmi/phdiffusion-painterly-image-harmonization/ldm/util.py official repository ran Apache-2.0 (permissive) · b1368330cf0f5642 · report
ismap bcmi/phdiffusion-painterly-image-harmonization/ldm/util.py official repository ran Apache-2.0 (permissive) · d72762b700feee6f · report
master_only bcmi/phdiffusion-painterly-image-harmonization/dist_util.py official repository ran Apache-2.0 (permissive) · f6b0e1eb5b7df3e3 · report
modcrop_np bcmi/phdiffusion-painterly-image-harmonization/ldm/modules/image_degradation/bsrgan.py official repository ran fingerprinted Apache-2.0 (permissive) · 04df7487a791a8a1 · report
uniq bcmi/phdiffusion-painterly-image-harmonization/ldm/modules/attention.py official repository ran · our draft was wrong Apache-2.0 (permissive) · 9a299fe5ae09e407 · report
get_bare_model bcmi/phdiffusion-painterly-image-harmonization/dist_util.py official repository unverified Apache-2.0 (permissive) · 0c7693e097d04d63 · report
log_txt_as_img bcmi/phdiffusion-painterly-image-harmonization/ldm/util.py official repository unverified Apache-2.0 (permissive) · 8f1a0aae78f523e7 · report
patches_from_image bcmi/phdiffusion-painterly-image-harmonization/ldm/modules/image_degradation/utils_image.py official repository unverified Apache-2.0 (permissive) · 3984b3ec31e90ef0 · report

Tasks

Image HarmonizationInference Optimizationmodel

1 archive task tag without a task page not shown.

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Diffusion

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections