Photo ka background White kr do

I'll read the PDF skill first, then process your photo.
Reading File
Now let me extract the image from the PDF and process it.
Running Command

cd /tmp/workspace && ls attachments/923c16bc-d7dc-4503-b558-d0f04e6c8b8c/

Running Command

python3 << 'EOF' import fitz # PyMuPDF import os pdf_path = '/tmp/workspace/attachments/923c16bc-d7dc-4503-b558-d0f04e6c8b8c/photo_compress(1) (1).pdf' doc = fitz.open(pdf_path) print(f"Pages: {len(doc)}") for page_num in range(len(doc)): page = doc[page_num] print(f"Page {page_num}: size={page.rect}") images = page.get_images(full=True) print(f" Images: {len(images)}") for img in images: print(f" xref={img[0]}, name={img[7]}, width={img[2]}, height={img[3]}, colorspace={img[5]}") EOF

Running Command

python3 << 'EOF' import pypdf from pypdf import PdfReader import io pdf_path = '/tmp/workspace/attachments/923c16bc-d7dc-4503-b558-d0f04e6c8b8c/photo_compress(1) (1).pdf' reader = PdfReader(pdf_path) print(f"Pages: {len(reader.pages)}") for i, page in enumerate(reader.pages): print(f"Page {i}: {page.mediabox}") # Try to get images if '/XObject' in page['/Resources']: xobjects = page['/Resources']['/XObject'].get_object() for name, obj in xobjects.items(): xobj = obj.get_object() print(f" XObject: {name}, Subtype: {xobj.get('/Subtype')}, W={xobj.get('/Width')}, H={xobj.get('/Height')}") EOF

Running Command

python3 << 'EOF' from pypdf import PdfReader from PIL import Image import io, os pdf_path = '/tmp/workspace/attachments/923c16bc-d7dc-4503-b558-d0f04e6c8b8c/photo_compress(1) (1).pdf' reader = PdfReader(pdf_path) page = reader.pages[0] xobjects = page['/Resources']['/XObject'].get_object() obj = xobjects['/Im1'].get_object() data = obj.get_data() colorspace = obj.get('/ColorSpace') width = obj['/Width'] height = obj['/Height'] bpc = obj.get('/BitsPerComponent', 8) print(f"ColorSpace: {colorspace}, W={width}, H={height}, BPC={bpc}") print(f"Data length: {len(data)}") # Try to open as image try: img = Image.open(io.BytesIO(data)) print(f"Format: {img.format}, Mode: {img.mode}, Size: {img.size}") img.save('/tmp/workspace/extracted_photo.png') print("Saved as PNG") except Exception as e: print(f"Direct open failed: {e}") # Try raw RGB try: if colorspace == '/DeviceRGB': img = Image.frombytes('RGB', (width, height), data) elif colorspace == '/DeviceCMYK': img = Image.frombytes('CMYK', (width, height), data) elif colorspace == '/DeviceGray': img = Image.frombytes('L', (width, height), data) else: img = Image.frombytes('RGB', (width, height), data) img.save('/tmp/workspace/extracted_photo.png') print(f"Saved raw as PNG, mode={img.mode}, size={img.size}") except Exception as e2: print(f"Raw open failed: {e2}") EOF

Photo extracted. Now let me remove the background and make it white.
Running Command

pip install --user rembg 2>&1 | tail -5

Running Command

python3 -c "from rembg import remove; print('rembg ok')"

Running Command

pip install rembg 2>&1 | tail -5

Running Command

python3 << 'EOF' from rembg import remove from PIL import Image import io # Open the extracted photo input_img = Image.open('/tmp/workspace/extracted_photo.png') print(f"Input: {input_img.mode}, {input_img.size}") # Remove background (returns RGBA image with transparent bg) output_img = remove(input_img) print(f"Output (after rembg): {output_img.mode}, {output_img.size}") # Create white background and paste white_bg = Image.new('RGB', output_img.size, (255, 255, 255)) white_bg.paste(output_img, mask=output_img.split()[3]) # use alpha channel as mask # Save as JPEG (white background photo) white_bg.save('/tmp/workspace/photo_white_bg.jpg', 'JPEG', quality=95) print("Saved: /tmp/workspace/photo_white_bg.jpg") # Also save as PDF from reportlab.lib.pagesizes import A4 from reportlab.platypus import SimpleDocTemplate, Image as RLImage from reportlab.lib.units import cm # Save white bg photo as PNG first white_bg.save('/tmp/workspace/photo_white_bg.png', 'PNG') # Make PDF doc = SimpleDocTemplate('/tmp/workspace/photo_white_bg.pdf', pagesize=A4) rl_img = RLImage('/tmp/workspace/photo_white_bg.png', width=15*cm, height=19*cm) doc.build([rl_img]) print("Saved: /tmp/workspace/photo_white_bg.pdf") EOF

Background removal done! Let me show you the result:
Loading Image
Ho gaya! Aapki photo ka background white kar diya gaya hai. Neeche se download karein:
Output Files:
  • JPEG (Photo):

    photo white bg

    Image ยท JPG

  • PNG (Transparent edges):

    photo white bg

    Image ยท PNG

  • PDF:

    photo white bg

    PDF Document ยท PDF

Kya kiya gaya:
  • PDF se original photo (1137x1414 px) extract ki
  • AI-based background removal (rembg/U2Net model) se background remove kiya
  • Pure white (255, 255, 255) background apply kiya
  • JPEG, PNG aur PDF teeno formats mein save kiya
Agar result mein koi problem ho (jaise edge kati ho ya background poora white na hua ho), toh batayein - main adjust kar dunga!

Thank you

You're welcome! ๐Ÿ˜Š Koi aur kaam ho toh zaroor batayein!

Isko or ache se banao pls

Pehle video dekh leta hoon kya result aaya hai abhi.
analyse_media
Video dekh li. Aapka matlab hai ki pehle jo white background photo bani thi, uski quality aur achhi karni hai - edges clean karni hain, aur better output chahiye.
Thoda clarify karein:
Asking for Preferences

Kya improve karna chahte ho?

Video k photo ko chlta firta hua dikhana h

Aap chahte hain ki video mein jo photos hain, unhe animated / moving effect ke saath dikhaya jaye - jaise Ken Burns effect (zoom in/out + pan), ya photo slide karte hue aaye. Seedha clarify karta hoon:
Asking for Preferences

Kaunsa moving effect chahiye? ยท Output kaise chahiye?

Theek hai! Sab effects mix karke MP4 banata hoon. Pehle photos extract karta hoon us video se.
Running Command

mkdir -p /tmp/workspace/animated-video && ls /tmp/workspace/

Running Command

cd /tmp/workspace/animated-video && wget -q "https://d361swluvexzqs.cloudfront.net/chats-attachments/Video-20260806-01-1786021354958-bi9fux.mp4" -O input_video.mp4 && ls -lh input_video.mp4

Running Command

curl -L "https://d361swluvexzqs.cloudfront.net/chats-attachments/Video-20260806-01-1786021354958-bi9fux.mp4" -o /tmp/workspace/animated-video/input_video.mp4 && ls -lh /tmp/workspace/animated-video/input_video.mp4

Video download ho gayi. Ab photos extract karta hoon.
Running Command

python3 << 'EOF' import cv2 import numpy as np import os video_path = '/tmp/workspace/animated-video/input_video.mp4' out_dir = '/tmp/workspace/animated-video/photos' os.makedirs(out_dir, exist_ok=True) cap = cv2.VideoCapture(video_path) fps = cap.get(cv2.CAP_PROP_FPS) total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) duration = total_frames / fps print(f"FPS: {fps}, Total frames: {total_frames}, Duration: {duration:.2f}s") # Extract one representative frame from each "photo segment" # Sample at regular intervals to get key frames # From the analysis: 6 photos, ~20 seconds long # Sample at 1s, 3s, 7s, 10s, 13s, 16s, 19s to catch each photo sample_times = [1.0, 3.5, 7.0, 10.0, 13.5, 16.5, 19.0] saved = [] for t in sample_times: frame_num = int(t * fps) if frame_num >= total_frames: continue cap.set(cv2.CAP_PROP_POS_FRAMES, frame_num) ret, frame = cap.read() if ret: path = f"{out_dir}/photo_{len(saved)+1:02d}.jpg" cv2.imwrite(path, frame, [cv2.IMWRITE_JPEG_QUALITY, 95]) saved.append(path) print(f"Saved frame at {t}s -> {path}, shape={frame.shape}") cap.release() print(f"\nTotal photos saved: {len(saved)}") EOF

7 photos mil gayi. Ab animation script likhta hoon - har photo pe alag effect (zoom, slide, rotate, pan) aur transition ke saath.
Running Command

python3 << 'EOF' import cv2 import numpy as np import os import glob photos_dir = '/tmp/workspace/animated-video/photos' output_path = '/tmp/workspace/animated-video/animated_output.mp4' # Load all photos photo_files = sorted(glob.glob(f"{photos_dir}/photo_*.jpg")) print(f"Photos found: {len(photo_files)}") W, H = 720, 720 FPS = 30 DURATION_PER_PHOTO = 3.5 # seconds per photo TRANSITION_FRAMES = 20 # frames for crossfade transition FRAMES_PER_PHOTO = int(FPS * DURATION_PER_PHOTO) fourcc = cv2.VideoWriter_fourcc(*'mp4v') writer = cv2.VideoWriter(output_path, fourcc, FPS, (W, H)) def resize_fill(img, w, h): """Resize image to fill w x h, center crop""" ih, iw = img.shape[:2] scale = max(w/iw, h/ih) * 1.3 # extra 30% for zoom room nw, nh = int(iw*scale), int(ih*scale) img = cv2.resize(img, (nw, nh), interpolation=cv2.INTER_LANCZOS4) x = (nw - w) // 2 y = (nh - h) // 2 return img[y:y+h, x:x+w] def apply_effect(img, effect, t, total): """Apply animated effect. t = frame index (0..total-1)""" progress = t / max(total - 1, 1) # 0.0 -> 1.0 ih, iw = img.shape[:2] if effect == 'zoom_in': # Ken Burns: slow zoom in from 1.0 to 1.15, slight pan right scale = 1.0 + 0.15 * progress cx = iw/2 + 20 * progress cy = ih/2 elif effect == 'zoom_out': # Ken Burns: zoom out 1.15 -> 1.0, pan left scale = 1.15 - 0.15 * progress cx = iw/2 - 20 * progress cy = ih/2 elif effect == 'pan_left': # Pan left to right scale = 1.1 cx = iw/2 - 40 + 80 * progress cy = ih/2 elif effect == 'pan_up': # Pan bottom to top scale = 1.12 cx = iw/2 cy = ih/2 + 40 - 80 * progress elif effect == 'rotate_zoom': # Slight rotation + zoom scale = 1.0 + 0.1 * progress angle = -2 + 4 * progress # -2 to +2 degrees cx, cy = iw/2, ih/2 M = cv2.getRotationMatrix2D((cx, cy), angle, scale) out = cv2.warpAffine(img, M, (iw, ih), flags=cv2.INTER_LANCZOS4, borderMode=cv2.BORDER_REFLECT) return out elif effect == 'diagonal_pan': # Pan diagonally scale = 1.15 cx = iw/2 - 30 + 60 * progress cy = ih/2 - 30 + 60 * progress else: return img # Affine zoom + pan M = cv2.getRotationMatrix2D((cx, cy), 0, scale) M[0, 2] += (W/2 - cx) M[1, 2] += (H/2 - cy) out = cv2.warpAffine(img, M, (W, H), flags=cv2.INTER_LANCZOS4, borderMode=cv2.BORDER_REFLECT) return out def crossfade(img1, img2, alpha): return cv2.addWeighted(img1, 1-alpha, img2, alpha, 0) # Effects list - assign different effect to each photo effects = ['zoom_in', 'zoom_out', 'pan_left', 'pan_up', 'rotate_zoom', 'diagonal_pan', 'zoom_in'] # Preload and prep images images = [] for p in photo_files: img = cv2.imread(p) img = resize_fill(img, W, H) images.append(img) print(f"Generating animated video with {len(images)} photos...") for idx, (img, effect) in enumerate(zip(images, effects)): print(f" Photo {idx+1}/{len(images)}: effect={effect}") next_img = images[idx+1] if idx+1 < len(images) else None # Pre-render all frames for this photo rendered = [] for t in range(FRAMES_PER_PHOTO): frame = apply_effect(img, effect, t, FRAMES_PER_PHOTO) rendered.append(frame) # Write main frames (minus last TRANSITION_FRAMES) main_end = FRAMES_PER_PHOTO - TRANSITION_FRAMES if next_img is not None else FRAMES_PER_PHOTO for t in range(main_end): writer.write(rendered[t]) # Write crossfade transition to next photo if next_img is not None: next_rendered = [] for t in range(TRANSITION_FRAMES): f = apply_effect(next_img, effects[idx+1], t, FRAMES_PER_PHOTO) next_rendered.append(f) for t in range(TRANSITION_FRAMES): alpha = t / TRANSITION_FRAMES blend = crossfade(rendered[main_end + t], next_rendered[t], alpha) writer.write(blend) writer.release() print(f"\nDone! Saved to: {output_path}") import os size = os.path.getsize(output_path) print(f"File size: {size/1024/1024:.2f} MB") EOF

Video ban gayi! Ab audio bhi original video se add karta hoon (agar hai to):
Running Command

# Check if ffmpeg available and add audio from original which ffmpeg && echo "ffmpeg available" || echo "no ffmpeg"

Running Command

# Try to add audio using moviepy python3 -c "from moviepy.editor import VideoFileClip; print('moviepy ok')"

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.

Ye bana kar de pls

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.

Hareli tihar ka video bana do animated

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.
This is a shared conversation. Sign in to Orris to start your own chat.