[Question]
  [
It's likely that anyone who used Twitter a couple of months ago would know about the 'Howdy! I'm the sheriff of X" meme. Where a simple image of a sheriff is drawn with emoji, and changes to fit a theme. So I thought it was time for the Sheriff of Code Golf. Here he is:
```
    ###
   #####
    ###
    ###
    ###
     #
   #####
  #  #  #
 #   #   #
 #   #   #
     #
    ###
   #   #
   #   #
   #   #
   #   #
```
This one in particular has 'pixels' which are one character wide, and one character high. To generate him, the arguments will be 1 and 1.
What if he is to be wider than he is tall?
```
      ######
    ##########
      ######
      ######
      ######
        ##
    ##########  
  ##    ##    ##
##      ##      ##
##      ##      ##
        ##
      ######
    ##      ##
    ##      ##
    ##      ##
    ##      ##
```
He's got a height of 1, but a width of 2.
---
# Rules:
* The challenge is to write code to draw your own Sheriff of Code Golf, in the fewest characters possible.
* Use any programming language your heart desires.
* Your code should take two arguments, both of which are integers, for the height and width of the Sheriff.
* The output should be composed of single white spaces for the background, and any other character(s) you choose for the Sheriff. (I've used hashes for the test cases, but it doesn't matter what you use).
* It should be possible for the height to be a negative integer, inverting the image.
* The width can be a negative integer, but because the image is symmetrical, it will be identical to it's positive value.
* Trailing white-spaces are irrelevant.
* If either argument is 0, that dimension is 'flattened' to a single row or column. The length of this line is the other argument multiplied by the height, or width of the Sheriff, respectively.
* If both arguments are 0, both lines are 'flattened', leaving a single positive character.
* Not essential, but please include a link to an online interpreter such as [tio.run](http://www.tio.run)
* The output should be a string, over multiple lines, or output to the console.
---
# Test Cases
1 high, 1 wide
```
    ###
   #####
    ###
    ###
    ###
     #
   #####
  #  #  #
 #   #   #
 #   #   #
     #
    ###
   #   #
   #   #
   #   #
   #   #   
```
2 high, 1 wide
```
    ###
    ###
   #####
   #####
    ###
    ###
    ###
    ###
    ###
    ###
     #
     #
   #####
   #####
  #  #  #
  #  #  #
 #   #   #
 #   #   #
 #   #   #
 #   #   #
     #
     #
    ###
    ###
   #   #
   #   #
   #   #
   #   #   
   #   #
   #   #
   #   #
   #   #  
```
1 high, 2 wide
```
      ######
    ##########
      ######
      ######
      ######
        ##
    ##########  
  ##    ##    ##
##      ##      ##
##      ##      ##
        ##
      ######
    ##      ##
    ##      ##
    ##      ##
    ##      ##
```
2 high, 2 wide
```
      ######
      ######
    ##########
    ##########
      ######
      ######
      ######
      ######
      ######
      ######
        ##
        ##
    ##########  
    ##########  
  ##    ##    ##
  ##    ##    ##
##      ##      ##
##      ##      ##
##      ##      ##
##      ##      ##
        ##
        ##
      ######
      ######
    ##      ##
    ##      ##
    ##      ##
    ##      ##
    ##      ##
    ##      ##
    ##      ##
    ##      ##
```
-1 high, 1 wide
```
   #   #
   #   #
   #   #
   #   #   
    ###
     #
 #   #   #
 #   #   #
  #  #  #
   #####
     #
    ###
    ###
    ###
   #####
    ###
```
1 high, -1 wide
```
    ###
   #####
    ###
    ###
    ###
     #
   #####
  #  #  #
 #   #   #
 #   #   #
     #
    ###
   #   #
   #   #
   #   #
   #   #   
```
0 high, 0 wide 
```
#
```
1 high, 0 wide
```
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
```
0 high, 2 wide
```
##################
```
---
Have fun, y'all!
  
[Answer]
# JavaScript (ES6), 171 bytes
Takes input in currying syntax `(width)(height)`. Returns an array of strings.
```
w=>h=>[...Array((h>0?h:-h)*16||1)].map((_,y)=>'012345678'.replace(/./g,x=>' #'[((c=+'3733317900134444'[(h<0?16-~y/h:y/h)|0]||17)>>4-x|c>>x-4)&1|!h].repeat(w>0?w:-w))||'#')
```
[Try it online!](https://tio.run/##VU7RTsMwDHznK4wmEZs1abKUFTYSxANfUSoUlW7ZNNqpm8gmAr9e2okXLJ3P9p1O3rpPd6i6zf7Im/a97lemD8Z6YwshxHPXuTOit/LJL7inWzWPUVEpPtwe8S05k7FMqpnO7ub5PRNdvd@5qsZUpOvkNGgwYQViZaZM51prlT9IqXQ21HD3j/JJzfnPOfWLARRlOaTnZG3GT7Gy9sQzulHx2pdjcu2OGIZPwoIHohjZhFG/LKCYJaDK5MJyZK4T4LNxkn@KHBUor8Sq7V5c5RGLkIAvCYyFL6ja5tDuarFr18iCYTCFMIBBCv6yeVr@M60wEHoS23bTIHttGE0vfQnf1P8C "JavaScript (Node.js) – Try It Online")
### How?
Only the left half of the sheriff is encoded as binary bitmasks, including the middle column:
```
    ##.         00011     3
   ###..        00111     7
    ##.         00011     3
    ##.         00011     3
    ##.         00011     3
     #          00001     1
   ###..        00111     7
  #  #  .       01001     9
 #   #   .  --> 10001 --> 17
 #   #   .      10001     17
     #          00001     1
    ##.         00011     3
   #   .        00100     4
   #   .        00100     4
   #   .        00100     4
   #   .        00100     4
```
Because there are only two values greater than \$9\$ and they're both equal to \$17\$, we can replace them with \$0\$ in order to have one character per row and still have a rather straightforward decoding process. Hence the packed string:
```
'3733317900134444'
```
For \$0 \le x \le 8\$ and \$0 \le y \le 15\$, the 'pixel' at \$(x,y)\$ is given by:
```
' #'[                                  // character lookup:
  (                                    //   0 = space
    (                                  //   1 = '#'
      c = +'3733317900134444'[y] || 17 // extract the bitmask for this row; 0 -> 17
    )   >> 4 - x                       // test the left part, middle column included
    | c >> x - 4                       // test the right part, middle column also included
  ) & 1                                // isolate the least significant bit
]                                      // end of character lookup
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~228~~ ~~218~~ ~~202~~ ~~189~~ 173 bytes
```
lambda h,w:sum(([''.join('# '[int(n)]*abs(w)for n in bin([62,120,224,238,438,750][int(l)])[2:])or'#']*abs(h)for l in'1211102455013333'),[])[::1-(h<0)*2]or['#'*9*abs(w)or'#']
```
[Try it online!](https://tio.run/##NY7basMwDIbv@xSCXtgKyrDUpAezPYnni4QRkpLYJW3p@vSZ43YCnfl@6fK89THI0n19L2MztT8N9PSw1/uktVPq4xyHoNUWlBvCTQf0RdNe9QO7OEOAIUCb9m4vxGJIpCLZHalKfqiNz8yIHp1Yj3FWW/Xi@8yPiVcszGykqmvDu2QKySXAWi51/2mwEB9nl8ji9D790llWhV96Jg2nmRhJS45Mkus1lvwelWsyZHJjci3o7QYu8/pj0sEN/P8EXR7YvINx@QM "Python 2 – Try It Online")
---
Alternatives:
# [Python 2](https://docs.python.org/2/), 173 bytes
```
lambda h,w:sum(([''.join('# '[int(n)]*abs(w)for n in bin(ord(' >w(8\x96I'[l])*l)[2:])or'#']*abs(h)for l in map(int,'3433314655132222')),[])[::1-(h<0)*2]or['#'*9*abs(w)or'#']
```
```
lambda h,w:sum(([''.join('# '[int(n)]*abs(w)for n in bin(ord(' >w(8\x96I'[int(l)])*int(l))[2:])or'#']*abs(h)for l in'3433314655132222'),[])[::1-(h<0)*2]or['#'*9*abs(w)or'#']
```
[Answer]
# [Perl 5](https://www.perl.org/), ~~169~~ ~~166~~ 157 bytes
```
@a=map"$_\n",(split 1,'  #####1   ###1    #1 #  #  #1#   #   #1  #   #')
[1011120344215555=~/./g];
print s/./$&x abs"@F"/ger x abs$F[1]for$F[1]<0?reverse@a:@a;
```
[Try it online!](https://tio.run/##JYjRCoIwGIVf5WeTLND0X/Mmk3blS5jEgikD07FJdNWjt@Y6HM53zjHKTpX3QjZPaUhyv80k2zsz6RUwSwHoJoRYNkBICtFIIZbt@jM9dFgiIitPnDOsgppPcSzGvjZWzyu4MJLdG@TDEdGSYlQW4kraDvthsZGX8mrVS1mnhDwLWXufc8jZdzGrXmbnc/kD "Perl 5 – Try It Online")
Maybe more could be gained by bit fiddling.
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 61 bytes
```
ＮθＮη¿θＦ⪪”{“↷Ｃ¿2t´⁴Ｑ19·“*Ｔy”!Ｅ↔θ∨⭆ι×μ↔η#×#∨×⁵↔η¹‖ＯＯ←∨↔η¹¿‹θ⁰‖↓
```
[Try it online!](https://tio.run/##TY/PbsMgDMbveQqXXIxEpHbVLs1p0i6TumZa@wJJ5CxI5M8ITR@fmZB2lbDhM9/PmLotbT2UxvuPfry607WryOKvzJNn3bLWDXAdmsECnkejHYo03aRL3FeUAEv6z@EuHJ5CKBAbISV8Wd07/CxHfKsmfkBBYfHsuPoTilrBRXc0YacgGFop2SJSRvOEzERrg2gSoS/zUb0@EAU7GYBvagzVrpjJmnJcNzwcqXELF@2LO374SBMPpWDLk64wHt6HWy9z77MXyPY@m80f "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
ＮθＮη
```
Input the dimensions.
```
¿θＦ⪪”{“↷Ｃ¿2t´⁴Ｑ19·“*Ｔy”!
```
If the height is nonzero, loop over the the right half of the sheriff...
```
Ｅ↔θ
```
... repeating the absolute height number of times...
```
∨⭆ι×μ↔η#
```
... if the width is nonzero then repeating each character the absolute number of times, otherwise a `#`.
```
×#∨×⁵↔η¹
```
But if the height is zero, then repeat `#` 5 times the absolute width, but at least 1 `#`.
```
‖ＯＯ←∨↔η¹
```
Reflect to produce the left half of the sheriff.
```
¿‹θ⁰‖↓
```
If the height is negative, flip the sheriff.
[Answer]
# [Python 2](https://docs.python.org/2/), ~~217~~ 216 bytes
```
h,w=input();t=[];w=abs(w)
for i in range(16):c=bin(32+int('37333179HH134444'[i],26))[-5:];t+=[[''.join(abs(w)*' #'[d>'0']for d in c+c[3::-1]),'#'][w==0]]*abs(h)
print['\n'.join(t[::[1,-1][h<0]]),'#'*(w*16or 1)][h==0]
```
[Try it online!](https://tio.run/##LY8xT8MwEIXn@ldY6nBx4qI4hlQ4mK2oGwub6yFxDDEgJzKu0v764BROujvp9N53etM1DqOvFjP2VgYAWAY6S@enc8xIE6XSzSzb7iebCXofA3bYeRxa/2EzVhNhZOd8xqvC@ZgB33PO2f7xeGT8PhUop2lVE6J2D0I3sZBKAdx9jsnzx8wBb0H1z1CCXvH9ijeFUVyIHdOEwha0mqUstc5Xy0DQFNIzBSf/T4pKCMVokqvhKelupjybc1YnIiPpvPqXFA7Ng/u2@C2crUA4hqtAG3uxBq/x0eZGRthejJ0iPry@HEIYQ9J0wbZfS0lLVNIKsbQZZakrtFtHRdnyCw "Python 2 – Try It Online")
A Pythonic riff on [Arnauld's approach](https://codegolf.stackexchange.com/a/169293/69880).
Ugh! Now works for all edge conditions...
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), ~~299~~ ~~275~~ 272 bytes
```
import StdEnv,Data.List
f=flatlines
r=repeatn
$0 0=['#']
$h w#w=abs w
|h==0=r(w*9)'#'
|w<1=f(r(abs h*16)['#'])
=f(if(h<0)reverse id[cjustify(w*9)(intercalate(spaces((0xde35945rem n)*10/n*w))(r((0xc8d88154f8fberem n)*10/n)(r w'#')))\\n<-map((^)10o~)[-16..0],_<-[1..abs h]])
```
[Try it online!](https://tio.run/##TZDBa8MgGMXv@SuEFqqhyZS1JYV46w6DHgY9ptmwRhdHNEFtXaHsT59z3WXH7/u9x3s8Pghmoh678yCAZspEpafRenDw3ZO5LHfMs3KvnM8klQPzgzLCZZZaMQnmTTbHANNmMVu02bwHYRYoOzkQsltPKaYWhnyLEs1uoSZUQgt/cZ@TDbqbUJaeSsK@xsiKi7BOANU1/OPsvJLXux0q44XlLKUL6CbGhYMQf3bicb1dra3QwKCc4AeTB4RSQmK86qqKrFeykifxT5EwCCkXIXQ8mrrQbILwFRE8fqGmIJuyxO3yrS4aUpb3om2L4sGztAcFc0AAid88zfDuYvG8j7urYVrxv@Ml9ZOj1bE4/QA "Clean – Try It Online")
[Answer]
# Powershell, ~~174~~ 170 bytes
Inspired by [Arnauld's](https://codegolf.stackexchange.com/users/58563/arnauld) [Javascript](https://codegolf.stackexchange.com/a/169293/80745)
```
param($w,$h)('CGCCCAGIQQACDDDD'[((0..15),(15..0))[$h-lt0]],31)[!$h]|%{$n=+$_
,(-join(4..0+1..4|%{,' #'[($n-shr$_)%2]*[Math]::Abs($w)}),'#')[!$w]*[Math]::Abs(($h,1)[!$h])}
```
Ungolfed, explained and test scripted:
```
<#
Script uses 5 bits of integer as 5 left chars of a line of a sheriff
Script ignores other bits in this integer, so we can use 6 bit to take a ASCII letter
    ##.         1 00011     C
   ###..        1 00111     G
    ##.         1 00011     C
    ##.         1 00011     C
    ##.         1 00011     C
     #          1 00001     A
   ###..        1 00111     G
  #  #  .       1 01001     I
 #   #   .  --> 1 10001 --> Q
 #   #   .      1 10001     Q
     #          1 00001     A
    ##.         1 00011     C
   #   .        1 00100     D
   #   .        1 00100     D
   #   .        1 00100     D
   #   .        1 00100     D
#>
$f = {
param($w,$h)
(
    'CGCCCAGIQQACDDDD'[             # 5 bits of each char correspond to 5 left symbols of line of sheriff.
        ((0..15),(15..0))[$h-lt0]], # forward or reverse sequence of chars
    31                              # or sequence of one element = 11111
)[!$h]|%{                           # choose a sequence and for each
    $n=+$_                          # integer or ASCII code
    ,(  -join(
            4..0+1..4|%{            # loop on bit range 4..0 and append fliped range 1..4
                ,' #'[($n-shr$_)%2]*[Math]::Abs($w)
            }                       # returns space or # depend on bit, repeat $w times
        ),
        '#'                         # returns # for $w equal 0
    )[!$w]*[Math]::Abs(($h,1)[!$h]) # choose a sheriff line, repeat $h times
}
}
@(
    ,(1,0)
    ,(0,1)
    ,(1,-1)
    ,(0,0)
    ,(1,1)
    ,(0,0)
    ,(-2,-1)
    ,(0,0)
    ,(2,2)
) | % {
    $w,$h = $_
    $r = &$f $w $h
    $r
}
```
]