<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zhirong Yang</title>
    <description>The latest articles on DEV Community by Zhirong Yang (@yzr_5a2f46fc74bc8ac).</description>
    <link>https://dev.to/yzr_5a2f46fc74bc8ac</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3420518%2F2fe12303-6201-4c31-bce2-5c7337d93c60.png</url>
      <title>DEV Community: Zhirong Yang</title>
      <link>https://dev.to/yzr_5a2f46fc74bc8ac</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yzr_5a2f46fc74bc8ac"/>
    <language>en</language>
    <item>
      <title>Build a Tag-Based Search System for Anime-Style Images in C++</title>
      <dc:creator>Zhirong Yang</dc:creator>
      <pubDate>Fri, 08 Aug 2025 01:26:33 +0000</pubDate>
      <link>https://dev.to/yzr_5a2f46fc74bc8ac/build-a-tag-based-search-system-for-anime-style-images-in-c-3joc</link>
      <guid>https://dev.to/yzr_5a2f46fc74bc8ac/build-a-tag-based-search-system-for-anime-style-images-in-c-3joc</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;When you manage a large folder of anime-style illustrations on your PC, you often want to &lt;strong&gt;filter images by specific tags&lt;/strong&gt; (e.g., &lt;em&gt;miko&lt;/em&gt;, &lt;em&gt;blonde hair&lt;/em&gt;, &lt;em&gt;short hair&lt;/em&gt;).&lt;br&gt;
 So I built a &lt;strong&gt;lightweight web app in C++&lt;/strong&gt; that searches a local image folder by tags.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Live demo:&lt;/strong&gt; &lt;a href="http://198.13.48.172:8080/" rel="noopener noreferrer"&gt;http://198.13.48.172:8080/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This post covers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What the app does and its key features&lt;/li&gt;
&lt;li&gt;How to search (with examples)&lt;/li&gt;
&lt;li&gt;Tech stack and implementation outline&lt;/li&gt;
&lt;li&gt;How tags are generated&lt;/li&gt;
&lt;li&gt;Demo and source code links&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  App Overview
&lt;/h2&gt;

&lt;p&gt;This web tool searches images that already have tag metadata and supports &lt;strong&gt;multi-tag queries&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Features:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AND filtering&lt;/strong&gt; with multiple tags&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Negative (exclude) tags&lt;/strong&gt; like &lt;code&gt;-long_hair&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No database required&lt;/strong&gt; — works on files in a local folder&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backend:&lt;/strong&gt; C++  |  &lt;strong&gt;Frontend:&lt;/strong&gt; simple HTML&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Examples
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; The following images are &lt;strong&gt;style-modified&lt;/strong&gt; versions of the original search results using ChatGPT’s image transformation, to avoid copyright issues.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  Miko + Blonde Hair + 1 Girl
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;miko, 1girl, blonde_hair
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7hbiurfz9ejh6roeiny6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7hbiurfz9ejh6roeiny6.png" alt="2025年8月6日 00_27_42.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Miko but exclude Long Hair and Black Hair
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;miko, -long_hair, -black_hair
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbri5lbdmdhg684xlz4dx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbri5lbdmdhg684xlz4dx.png" alt="2025年8月6日 00_33_00.png" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  Advanced Search Options
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Find images where the &lt;em&gt;blonde_hair&lt;/em&gt; score ≥ 0.8
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;blonde_hair:0.8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Miko + Blonde Hair (≥ 0.9) + exclude Long Hair
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;miko, blonde_hair:0.9, -long_hair
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;h3&gt;
  
  
  Exclude images with high explicitness
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;miko, -explicit:0.3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How Tag Data Is Generated (img2tags + JSON)
&lt;/h2&gt;

&lt;p&gt;Tags are generated automatically with the Python tool &lt;strong&gt;&lt;a href="https://github.com/shirayu/img2tags" rel="noopener noreferrer"&gt;&lt;code&gt;img2tags&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;.&lt;br&gt;
 It uses a DeepDanbooru-style ViT model and outputs &lt;strong&gt;nested JSON&lt;/strong&gt; containing tags and scores per image.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
    "tags": {
        "9": {
            "general": 0.9189,
            "sensitive": 0.1126,
            "questionable": 0.0131,
            "explicit": 0.0193
        },
        "0": {
            "simple_background": 0.7185,
            "english_text": 0.6080,
            "no_humans": 0.5793,
            "parody": 0.8484,
            "black_background": 0.9437,
            "title_parody": 0.5970,
            "blending": 0.8171,
            "logo_parody": 0.5945
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;"tags"&lt;/code&gt; — root of the structure&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"9"&lt;/code&gt; — &lt;strong&gt;rating-related category&lt;/strong&gt; (&lt;code&gt;general&lt;/code&gt;, &lt;code&gt;explicit&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;"0"&lt;/code&gt; — &lt;strong&gt;general tags&lt;/strong&gt; (character, attributes, background, etc.)&lt;/li&gt;
&lt;li&gt;Each tag has a score in &lt;strong&gt;[0.0, 1.0]&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Demo &amp;amp; Source Code
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Live demo:&lt;/strong&gt; &lt;a href="http://198.13.48.172:8080/" rel="noopener noreferrer"&gt;http://198.13.48.172:8080/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub repo:&lt;/strong&gt; &lt;a href="https://github.com/Zhirong641/TagSearchWeb" rel="noopener noreferrer"&gt;https://github.com/Zhirong641/TagSearchWeb&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Technical Notes
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Backend:&lt;/strong&gt; simple HTTP server written in C++&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No DB:&lt;/strong&gt; images + tag JSON files on disk are enough&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frontend:&lt;/strong&gt; HTML + JavaScript (simple search form)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Negative tags&lt;/strong&gt; supported (NOT filtering)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Results&lt;/strong&gt; rendered as an image grid&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Roadmap
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Tag auto-completion &amp;amp; fuzzy search&lt;/li&gt;
&lt;li&gt;UX improvements (lazy loading)&lt;/li&gt;
&lt;li&gt;Simple UI for tag editing/fixes&lt;/li&gt;
&lt;li&gt;Optional SQLite for larger datasets&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Closing
&lt;/h2&gt;

&lt;p&gt;If you want to organize your image collection and quickly pull things up by tags, this is handy.&lt;br&gt;
 I also hope it’s a useful reference for anyone who wants to try a small web tool &lt;strong&gt;in C++&lt;/strong&gt;.&lt;/p&gt;

</description>
      <category>cpp</category>
      <category>img</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
