HedronCreeper commited on
Commit
3230f87
·
verified ·
1 Parent(s): 5b86a84

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -34,7 +34,8 @@ def get_font_for_height(target_px):
34
  def make_base_image(w, h):
35
  img = Image.new("RGB", (w, h), BG_COLOR)
36
  draw = ImageDraw.Draw(img)
37
- target_h = int(min(w, h) * 2.0)
 
38
  target_h = min(target_h, min(w, h) - 4)
39
  font = get_font_for_height(target_h)
40
  bbox = draw.textbbox((0, 0), "CC", font=font)
@@ -48,7 +49,8 @@ def make_base_image(w, h):
48
  def calc_size(payload_bytes):
49
  total_bits = (len(payload_bytes) + 4) * 8
50
  pixels_needed = math.ceil(total_bits / 6)
51
- side = max(MIN_SIZE, math.ceil(math.sqrt(pixels_needed * 4.5)))
 
52
  return side, side
53
 
54
  def get_carriers(w, h):
@@ -192,4 +194,4 @@ def decode_route():
192
  return jsonify({"error": "Unknown mode"}), 400
193
 
194
  if __name__ == "__main__":
195
- app.run(host="0.0.0.0", port=7860)
 
34
  def make_base_image(w, h):
35
  img = Image.new("RGB", (w, h), BG_COLOR)
36
  draw = ImageDraw.Draw(img)
37
+ # Make the text 5 times bigger
38
+ target_h = int(min(w, h) * 10.0) # Increased from 2.0 to 10.0 (5x larger)
39
  target_h = min(target_h, min(w, h) - 4)
40
  font = get_font_for_height(target_h)
41
  bbox = draw.textbbox((0, 0), "CC", font=font)
 
49
  def calc_size(payload_bytes):
50
  total_bits = (len(payload_bytes) + 4) * 8
51
  pixels_needed = math.ceil(total_bits / 6)
52
+ # Increase size calculation to accommodate larger text
53
+ side = max(MIN_SIZE, math.ceil(math.sqrt(pixels_needed * 4.5 * 25))) # 25 = 5^2 (area scaling factor)
54
  return side, side
55
 
56
  def get_carriers(w, h):
 
194
  return jsonify({"error": "Unknown mode"}), 400
195
 
196
  if __name__ == "__main__":
197
+ app.run(host="0.0.0.0", port=7860)