<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>ED105</author_name>
  <author_url>https://blog.hatena.ne.jp/ED105/</author_url>
  <blog_title>43号線を西へ東へ</blog_title>
  <blog_url>https://driveon43.com/</blog_url>
  <categories>
    <anon>Python</anon>
    <anon>AI</anon>
  </categories>
  <description>AIで画像作成をするとき、背景の透過を忘れることが多いです。背景付きの画像を消してその物体だけを際出させたい、そんなときにPythonスクリプトでちゃちゃっと消すコードを作成しました。 Pythonでは、様々な機能を持ったライブラリを使うことで、自分の作業に最適化したアプリ的なものを作れます。 複雑な画像から人物を抜き出して背景を透過する手順ならrembgというライブラリがおすすめらしいですが、均等な背景に人やものが描かれた画像を扱っている私の使用環境では、残念ながらきれいに透過されませんでした。 今回はrembgを使わず、Numpyで画像の中にある色を集計して、一番多い色を背景と見なして、P…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdriveon43.com%2Fentry%2F2025%2F09%2F25%2F154605&quot; title=&quot;背景を計算して透過するPythonスクリプト - 43号線を西へ東へ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url>https://cdn-ak.f.st-hatena.com/images/fotolife/E/ED105/20250925/20250925085807.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2025-09-25 15:46:05</published>
  <title>背景を計算して透過するPythonスクリプト</title>
  <type>rich</type>
  <url>https://driveon43.com/entry/2025/09/25/154605</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
