code: def image_to_image(
      self,
      params: SamplingParams,
      image,
      prompt: str,
      negative_prompt: str = "",
      samples: int = 1,
      return_latents: bool = False,
  ):
      sampler = get_sampler_config(params)
  
      if params.img2img_strength < 1.0:
          sampler.discretization = Img2ImgDiscretizationWrapper(
              sampler.discretization,
              strength=params.img2img_strength,
          )
      height, width = image.shape[2], image.shape[3]
      value_dict = asdict(params)
      value_dict["prompt"] = prompt
      value_dict["negative_prompt"] = negative_prompt
      value_dict["target_width"] = width
      value_dict["target_height"] = height
      return do_img2img(
          image,
          self.model,
          sampler,
          value_dict,
          samples,
          force_uc_zero_embeddings=["txt"]
          if not self.specs.is_legacy
          else [],
          return_latents=return_latents,
          filter=None,
      )
  
imports: import pathlib
  from dataclasses import asdict, dataclass
  from enum import Enum
  from typing import Optional
  from omegaconf import OmegaConf
  from sgm.inference.helpers import Img2ImgDiscretizationWrapper, do_img2img, do_sample
  from sgm.modules.diffusionmodules.sampling import DPMPP2MSampler, DPMPP2SAncestralSampler, EulerAncestralSampler, EulerEDMSampler, HeunEDMSampler, LinearMultistepSampler
  from sgm.util import load_model_from_config
label_desc: Use image node_id 4 for calling the SamplingPipeline obj's underlying member method code with example usage: obj.image_to_image(params, image, prompt, negative_prompt, samples, return_latents) and returns: do_img2img